the web developer

The 21 Most Important Tools and Resources Used In Order to Develop a Website

The Internet today, is full of tools and resources, which can definitely help anyone develop a website. The timeframe that a developer spends on the site, will determine whether or not the website...

improvement

The 101 Most Useful Principles, Which Can Help Improve Your Life Forever

If we ever wondered why your life is not working as it you thought it should, it may be because you need to employ certain actions, which would take you to the next level. In today’s article, we...

Robot assisted surgery

Robot Assisted Surgery Will Change The Medical Field In Surgical Procedures

Robots are an amazing human invention, which we were able to accomplish due to the knowledge and understanding we have about the human body.

In today’s article we are going to talk about...

location based services

Location Based Services Are Changing The Way We Experience Mobile Devices

Our mobile world, has changed and will continue to change in the future; we need to be aware of these changes, so that they don’t catch us by surprise.

In today’s article, we are going to...

sd wan

Software Defined Wide Area Network, is The Future Of Network Infrastructure

Networking professionals have to now change their approach to networking design, due to the rapid change, that is happening in technology.

The introduction of cloud, the changes in IT...

Error message

Notice: Undefined variable: front_page in eval() (line 19 of /home/content/93/10477193/html/modules/php/php.module(80) : eval()'d code).

Mastering Cascading Style Sheet - Structuring Your Code - Selectors Advanced and Child Selectors

selector

In the world of technology, many are fighting to be the best programmer is the world, which is not a bad idea; but to do that, developers have to get on their grind and learn new things on a daily basis.

When a developer is not sharpening their skills on a daily basis, then another developer, will take their spot, at a job, or at an opportunity; because the previous developer, was not on his/her job.

In today’s article we are going to continue talking about CSS3 in particular those selectors, which we’ve discussed in our last article.

We still have to talk about the other selectors, which you may or may not encounter in your web development experience.

One other selector, which we have not talked about is, the universal selector, which is one of the most powerful selectors seen in CSS, but is also the least used selector, of all the selectors available in CSS.

Matching all of the available elements, the universal selector, acts as a wildcard; the universal selector is also denoted, by an asterisk; similar to wildcards in other programming languages.

Every element on a page is styled, when the universal selector is used, using the following CSS rule, for example.

* {

padding: 0; 

margin: 0;

}

would remove the default browser padding and margin on every element.

The universal selector can be used, to style all the descendants of a particular element, when it is combined with other selector; also the universal selector can be used, to skip a level of elements as well.

When using selectors, a front-end web developer, has to keep in mind that browsers, will be a problem, for the page to load correctly.

Advanced selectors are supported by modern browsers, such as Firefox and Safari, but Internet Explorer or IE is always a pain, when it comes to front end web development.

But if a browser does not support certain selectors, due to lack of understanding, then the browser, ignores that selector, because CSS fortunately, was developed with backward compatibility in mind, which means it knows that some browsers are too dumb to understand the language.

A developer who is designing an HTML document, doesn’t have to worry about causing problems, in older browsers, when the developer is applying, their stylistic and usability establishments.

Advanced selectors, are usually used, for something critical such as, the critical functioning of a website.

There are also child and adjacent sibling selectors, which are a type of advanced selectors; the child selector only targets, the elements immediate descendant, or children, which is in contrast with the descendant selectors, which will select all the descendants of an elements.

The > combinator is used to separate, the two selectors and matches only those elements matched by the second selector that are direct children of elements matched by the first.

This is the syntax of the child selectors: selector1 > selector2 { style properties } and here is a good example, where the first div will turn red.

span { background-color: white; }

div > span {

color: red;

}

<div>

<span>Span #1, in the div.

<span>Span #2, in the span that's in the div</span>

</span>

</div>

<span>Span #3, not in the div at all.

</span>

Span #1, in the div

Span #2, in the span that's in the div Span #3, not in the div at all

If you can notice on the child selector, the first div is turning to the color we selected at the top.

If you still have questions about these selectors, don’t forget to browse the website, to find much more important information, which would be good for your research on front-end development.

Thank you, for reading this article!!!