+ 2

What does(((( .first em)))) exactly mean ,please ?

css

3rd Sep 2017, 6:56 PM
Marwa Ali
Marwa Ali - avatar
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
3rd Sep 2017, 7:10 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 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
4th Sep 2017, 7:22 AM
visph
visph - avatar
0
can you please share the rest of the code
3rd Sep 2017, 6:57 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
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: }
3rd Sep 2017, 7:02 PM
Marwa Ali
Marwa Ali - avatar