+ 1

What is the difference between the instructions used in the body{} and .body{} in css3

When we give a body class and go to the css3 file, what is the difference between the instructions used for body {}; and .body{}; ??? <body class="body"> <section>............</section> <div>..........</div> ........................... .............................. ............................... </body> and i file css3 What is the difference between .body{ ................... .................. ...............} and body{ ...................................... ............................. ......................}

4th Nov 2018, 8:44 AM
program programing
program programing - avatar
7 Respuestas
+ 3
body without the dot selects the body element. body with the dot selects all elements with the class="body".
4th Nov 2018, 9:06 AM
Janning⭐
Janning⭐ - avatar
+ 3
Conflicts occur when you have two different values for the same property where only one can render. Example: .body { color: blue; } body { color: red; } The text will be blue because it has a higher specificity. Further reading: https://css-tricks.com/specifics-on-css-specificity/
4th Nov 2018, 10:30 AM
Janning⭐
Janning⭐ - avatar
+ 2
In that case, both styles will be applied. Where there is conflict, the class selector will override the element selector due to higher specificity.
4th Nov 2018, 10:02 AM
Janning⭐
Janning⭐ - avatar
+ 2
thank you very much finally I found my answer :)
4th Nov 2018, 10:38 AM
program programing
program programing - avatar
+ 1
Thank you very much Janning for the answer but I mean <body class="body"> <section>............</section> <div>..........</div> ........................... .............................. ............................... </body> and i file css3 What is the difference between .body{ ................... .................. ...............} and body{ ...................................... ............................. ......................}
4th Nov 2018, 9:57 AM
program programing
program programing - avatar
+ 1
Happy to help. 🙂
4th Nov 2018, 10:48 AM
Janning⭐
Janning⭐ - avatar
0
do you mean when there is a conflict will be applied inside .body{} first.??? but if possible please example of conflict ???
4th Nov 2018, 10:13 AM
program programing
program programing - avatar