Why can't semicolon be inserted through javascript style attribute?

I tried changing bcakground bodyto javascript and noticed that the following does not work:

document.body.style.background = "#000;"  

But if I omit the semicolon, then it works:

document.body.style.background = "#000"  

Why is that? Isn't there #000;still a line?

+4
source share
2 answers

;not part of the meaning. This is a style separator.

selector {
    styleName: styleValue;
    /* Separator --------^----- */
}

From specification :

A rule set (also called a "rule") consists of a selector, followed by a declaration block.

({) (}). (;) .

( ;) . , #000; , .

+6

# 000; : # 000;; css

-1

Source: https://habr.com/ru/post/1659922/


All Articles