PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, December 16, 2022

[FIXED] Why does CSS use colons ":" in rules?

 December 16, 2022     css, language-design, syntax     No comments   

Issue

CSS properties use no spaces so why isn't the first space in the rule used as a separator between the property and the value?

Here's an example:

enter image description here


Solution

Why not remove the curly-braces as well and let indentation dictate the structure? That would be even cleaner.

However, sometimes better syntax is not about removing everything you can imagine, you often need to keep something to keep the syntax clear as well. A syntax that is more clear expresses the intention in a better way than a cleaner, more implicit syntax. It's harder to make mistakes with an explicit syntax, and easier to spot those mistakes.

In your two examples, I find the first one a lot easier to understand, because the key and the value are clearly, explicitly separated.



Answered By - Fredrik Mörk
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing