+ 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{ ...................................... ............................. ......................}
7 Respostas
+ 3
body without the dot selects the body element.
body with the dot selects all elements with the class="body".
+ 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/
+ 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.
+ 2
thank you very much finally I found my answer :)
+ 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{
......................................
.............................
......................}
+ 1
Happy to help. 🙂
0
do you mean when there is a conflict will be applied inside
.body{} first.???
but if possible please example of conflict ???