admin管理员组文章数量:1406019
I am getting a syntax error for missed semicolon. I do not see where I am missing one.
I am new to coding. I am trying to adjust the size of an image that is generated by an Api. The picture currently shows in random sizes which throws the page off. So I have tried googling, searching for code help and rewriting the code.
This is the error:
/src/index.css (./node_modules/css-loader??ref--6-oneOf-3-
1!./node_modules/postcss-loader/src??postcss!./src/index.css)
Syntax error: Missed semicolon (2:17)
1 | img src {
> 2 | max-height: 25%
| ^
3 | max-width: 25%
This is the actual code:
img src {
max-height: 25%;
max-width: 25%;
}
I am getting a syntax error for missed semicolon. I do not see where I am missing one.
I am new to coding. I am trying to adjust the size of an image that is generated by an Api. The picture currently shows in random sizes which throws the page off. So I have tried googling, searching for code help and rewriting the code.
This is the error:
/src/index.css (./node_modules/css-loader??ref--6-oneOf-3-
1!./node_modules/postcss-loader/src??postcss!./src/index.css)
Syntax error: Missed semicolon (2:17)
1 | img src {
> 2 | max-height: 25%
| ^
3 | max-width: 25%
This is the actual code:
img src {
max-height: 25%;
max-width: 25%;
}
Share
Improve this question
edited Mar 28, 2019 at 4:02
31piy
23.9k6 gold badges51 silver badges68 bronze badges
asked Mar 28, 2019 at 3:47
Shenikia ThomasShenikia Thomas
151 gold badge1 silver badge1 bronze badge
4
- can you post line 2 of index.css – Seba Cherian Commented Mar 28, 2019 at 3:52
- 2 The CSS rules end with semicolons. The error contains the code without semicolons, but you posted code with semicolons. There seems a discrepancy. If you're using a bundler such as webpack, try to see from where it gets your CSS. – 31piy Commented Mar 28, 2019 at 4:04
- I removed src from after img and the same error appeared. Line 2 is the max-height: 25%; – Shenikia Thomas Commented Mar 28, 2019 at 4:07
- The issue most likely is somewhere else in the css file.The syntax parser is mistakenly indicating the line number (may be even the error message itself, maybe the actual issue is not a missing semicolon at all).Wele to programming. – Arnab Bhagabati Commented Mar 28, 2019 at 4:22
1 Answer
Reset to default 3Your selection syntax is new to me. If you are selecting the image's src
attribute, try
img[src] {
max-height: 25%;
max-width: 25%;
}
The above example will allow you to select any image with a src
attribute.
If this does not remedy the problem, please post a larger chunk of your CSS.
本文标签:
版权声明:本文标题:javascript - How to fix syntax error, "Missed semicolon", but the semicolon is there? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744967591a2635042.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论