Trailing semicolon in inline style tags
See original GitHub issuePrettier 2.0.2 Playground link
--parser html
Input:
<!DOCTYPE html>
<html>
<body>
<div style="padding: 5px">
Hello
</div>
</body>
</html>
Output:
<!DOCTYPE html>
<html>
<body>
<div style="padding: 5px;">
Hello
</div>
</body>
</html>
Expected behavior:
I would expect a trailing semicolon not to be added to inline style tags that contain a single property.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Inline CSS formatting best practices - Two questions
The normal rules of CSS apply inside the style attribute. Each CSS statement must be separated with a semicolon ";" and colons appear...
Read more >Is a closing semicolon required in css and other question
A trailing semi-colon is not needed on the last rule. e.g. However, personally I only ever omit the semi colon when I use...
Read more >declaration-block-trailing-semicolon - Stylelint
The trailing semicolon is the last semicolon in a declaration block and it is optional. This rule ignores: Less mixins; trailing // comments ......
Read more >Inline Styles in HTML - Codecademy
Inline styles directly affect the tag they are written in, without the use of selectors. ... Don't forget to include the semicolon ;...
Read more >How Style Sheets Work (Web Design in a Nutshell, 2nd Edition)
Inline styles. Style information can be added to an individual element by adding the style attribute within the HTML tag for that element....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Although both syntaxes are valid, I agree with you that we shouldn’t put a trailing semicolon on single-line
style
attributes just like we don’t put trailing commas on single-line objects in JS, which is what these strings are most similar to.Agree