I am really bad in CSS,
I often see people using colon + space :-
a {color: red;} /* colon followed by space */
a {color:red;} /* instead of this */
Both still does the same (at least browser still renders it the same).
So, is this just a code formatting preference?
(Does it carry any hidden meaning ?)
Sometimes Important: SpacesThere are just a few places that spaces are important in CSS. One of the most important is in selectors. One space in a selector means you're selecting descendants of the previous part of the selector. The selector body p means “select p elements that are descendants of the body element”.
If you find yourself in html needing a space you can always insert In your situation you can add a space, but only one. Additional spaces are ignored.
A CSS declaration block is an ordered collection of CSS properties and values. It is represented in the DOM as a CSSStyleDeclaration . Each property and value pairing is known as a CSS declaration.
It is not necessary, it's just a readability preference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With