Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS New to CSS; Code works but still needs someone to check please Reply To: New to CSS; Code works but still needs someone to check please

#250903
Beverleyh
Participant

All it’s essentially stating is, if you’re not using a 0(zero) you should use some unit of measurement (px, rem, etc.). For your “*” selector, just put some unit, looks like you’re referencing px.
FROM
* {margin: 1; padding: 1;}
TO
* {margin: 1px; padding: 1px;}

Do you mean this warning?

Disallow universal selector – The universal selector (*) is known to be slow.

While the comment on using a unit of measure on values greater than 0 is, in this line, correct, the interpretation of the warning isn’t. The warning is advising that the * selector (which is targeting everything on the page) is slower than targeting a specific element. To remove this warning, the OP should change the selector for something more specific.

I expect that it was at some point * { margin: 0; padding: 0; } (Google “poor man’s CSS reset” for more info) which is removing all the padding and margin for everything on the page, hence, potential speed issues on complex pages. To make it more specific, you would change the selector so that it targets and applies to elements you’re using – ones where you need/want to have their margin/padding completely removed. Example body, html { margin: 0; padding: 0; }

the at-rules are vendor-specific, meaning they won’t validate through CSS validation

Not sure how you arrived at that conclusion. The validator will correctly process vendor-specific CSS regardless of what browser is being used to perform the validation.