CSS code does not work if I put ".". before any element

I am using 4.5.1 Framewok and VS 2013. My problem is that my CSS code does not work if I write the following:

.body { font-family: Verdana, Arial, sans-serif; font-size: 14px; background: gainsboro; } 

But if I write like this, it works:

 body { font-family: Verdana, Arial, sans-serif; font-size: 14px; background: gainsboro; } 

What could be the reason for this? I watched several videos in which they use ".body", their projects work, but if I write this too, it will not work. Can you help me?

+5
source share
2 answers

"." NAME will affect all tags with class = "NAME"
"#" NAME will affect the tag with id = "NAME"
"NAME" will affect all html elements of type NAME

If you want to apply the style to BODY, you need to remove the ".". If you have tags with the class = tag, then you use ".body".

+3
source

if in your html you use body as a tag, then in your css you should use "body {content ....}". However, if you use the body as the "div class =" body class, then you can style the div with .body.

+2
source

All Articles