CSS error handling

How CSS handles errors

CSS is flexible. When an error is found, it will not package all the content and disappear completely like JavaScript, and terminate all script execution after the error is found.

CSS will do its best.

If there is an error in a line, it will skip that line and skip to the next line without any error.

If you forget the semicolon in a line:

p {
  font-size: 20px
  color: black;
  border: 1px solid black;

Wrong line, the next one willIs notApplied, but the third rule will be successfully applied to the page. Basically, it scans everything until it finds a semicolon, but until it reaches it, the rule isfont-size: 20px color: black;, This is invalid, so skip it.

Sometimes, because the browser won’t tell us, it’s hard to realize what’s wrong and where the error is.

That's why something likeCSS Lintexist.

Download mine for freeCSS Manual

More CSS tutorials: