Search code examples
csswhitespaceconventions

CSS files property:value vs property: value (whitespace)


According to W3Schools, saying property: value is not as correct as saying property:value. While both ways work fine and it probably doesn't matter, I was wondering if one way is preferred over the other.


Solution

  • I would say this isn't something to worry about and you'll see both, probably even mixed. I personally use property: value but it is entirely in the vain of cleaner, more readable code. I would say that you should be careful in taking everything you read from W3Schools to heart. There are definitely people who disagree with them on a lot of things.