Jump to content
Sign in to follow this  
_david_aaron

Ordering CSS declarations in a declaration block

Recommended Posts

W3Schools seems to be pretty consistent in the way declarations are ordered in a declaration block. What is this based off of? Do they have a style guide for this? What are recommended practices for ordering declarations?

Thanks!

Share this post


Link to post
Share on other sites

A property and value pair is called declaration.

Both property and value is case-insensitive by default in CSS.

The pair is separated by colon " : ".

Whenever you put declaration in open and close braces it's called declaration block.

And declaration inside them is separated by semi-colon.

ex:

*{

color : red;

margin : 10px;

}

I think there is no such type of guidance for declaration block.

But you should write declaration block first for the whole element (*), after that for body element (body), and last is for every class or id selector.

I hope this'll help you.

Thanks!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...