Inline CSS formatting best practices - Two questions

后端 未结 4 1981
遥遥无期
遥遥无期 2020-12-08 07:28

Question #1 - When specifying an inline style in an HTML element, is it necessary to include a trailing semi-colon? For example ...

4条回答
  •  被撕碎了的回忆
    2020-12-08 07:56

    Question 1: Yes (if you have more than one inline-style specified. Even it's not required for the last one, it's a good practice to append ; after each one).

    Quote:

    The normal rules of CSS apply inside the style attribute. Each CSS statement must be separated with a semicolon ";" and colons appear between the CSS property and its value.

    Question 2: No, but you can add it to be easier to read. For instance, Eclipse formatting automatically adds this space.

提交回复
热议问题