+ 2
What does(((( .first em)))) exactly mean ,please ?
css
4 Antworten
+ 2
firstly the html===
div is created with an id intro..
which has 4 paragraphs (<p> tag>) and each paragraph have different classes.. the first class of first paragraph is "first"
and that paragraph has an (<em> tag) emphasised text (i.e. similar to italic)
the css====
#intro .first em
(please do note that there is space between #intro and . first and em)
it is similar to directory mapping..
like here.. #intro the outer element and then comes the first paragraph with class (.first) and then comes the <em> tag.. if you want to style the element then you have to go in a proper hierarchy..
and in CSS we use the Id with #id and classes with .class
+ 3
No need of html code to read/understand a css selector ^^
#intro .first em
... will select all <em> element wich are descendant of a container with 'first' class set and itself descendant of the element with the 'intro' id ;)
In (occidental) common reading order (left from right), you can rather say: select the element with id 'intro', inside it find all elements with class 'first', and finally inside each of them find all <em> elements :P
0
can you please share the rest of the code
0
<div id="intro">
<p class="first">This is a <em> paragraph.</em></p>
<p> This is the second paragraph. </p>
</div>
<p class="first"> This is not in the intro section.</p>
<p> The second paragraph is not in the intro section. </p>
=== so css file was #intro.first em { color: ; background-color: }