There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
Hello, mine didn’t change to red after I carried out the instruction given both in the previous one and two.
and moreso I’m unable to paste anything I copied, is there any solution to that
In the exercise we were asked to write the code with universal selector at the beginning of the document, is the order of the selectors in the code something to be wary of ?
I have found that when coping code syntax into the ccs editor, the copy text isn’t always recognized.
When I typed the code itself into the ccs editor it typically works.
I know that sounds like a pain, but it was the only way I got some of the lessons to function well.
I am certain that by now this was figured out; however, in the event someone else has the same issue later hopefully this post will help.
Hello, What is the main difference between universal selectors and selector? and in what situations are the best to use different types of universal selectors?
From the class, the type selector is used for styling a specific element tag, for example, p element. While Universal selector, just as the name implies, applies styling generally to the HTML element regardless of the elements.
However, a Universal selector is used in specific use cases. For example, a Universal selector could be used to give a border to an aspect of an HTML document.
The p selector will apply to all p elements, and the border specified for p will override the border specified for the universal selector (* ). The * selector targets all elements, but its lower specificity means it won’t override a more specific selector like the type selector (p in this case).
For the universal selector (*), its specificity is quite low, meaning it’s less specific than most other types of selectors. Therefore, if you use the universal selector to apply styles to all elements, you might want to place it at the beginning of your stylesheet to provide a baseline style for all elements.
However, the position of the universal selector within the stylesheet is not a strict rule, and there may be cases where you intentionally place it elsewhere based on your design and styling needs. For example, you might use the universal selector later in your stylesheet to reset or normalize styles for specific elements after other styles have been applied.
Here’s an example:
/* Reset or normalize styles for all elements */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Other styles for specific elements */
body {
font-family: 'Arial', sans-serif;
background-color: #f0f0f0;
}
p {
color: #333;
margin-bottom: 10px;
}
It is generally written high up in the cascade to prevent potential collisions with other selectors. When written lower in the cascade it can potentially override selector rules that are written above it.
The universal selector is very far reaching and should only be used under the full understanding of what role it serves. For this writer, the jury has always been out on whether to use it, at all. One has never really found a good reason, apart from expediency and supposed convenience. Use it with care and consideration.
Any that are the least important. Build down from generic to specific and aim for the greatest generality, and least specificity. The cascade is derived from the order in which the rulesets fall. The lower in the cascade, the more important.
Specificity runs perpendicular to this and is the means by which we can override the cascade. If nothing else, drill down into the relation of these two concepts before pressing any further. It really means a lot… The lot.