White space in CSS

Is white space in CSS equal as in the C and C++ languages?

For those unfamiliar with C and C++, is a newline in CSS (not in HTML) the same as a space character? Or is it important for !important to be on the same line?

I tried searching but Google gets confused and thinks I am asking about how CSS affects white space in HTML.

In the lesson about !important I had !important in a separate line and that was rejected. When I removed the newline it was accepted. I used the fiddle in CSS !important Property and a newline did not affect the result so I assume the test software is not accurate.

As far as I’m aware CSS treats newline the same as whitespace. Many of the FCC challenges are strict on how they want you to structure your code, so I assume that’s why it did not work for FCC.

I say this without confirmation from documentation, merely basing this on the fact that when I add stuff like multiple box-shadows to one CSS selector, I tend to comma and newline after each box-shadow to keep it easier to read.

1 Like

I found the standard at CSS Syntax Module Level 3. It defines whitespace as a space, tab or newline and I think that is definitive. So I probably should have posted this somewhere appropriate for feedback.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.