javascript - How to fix syntax error, "Missed semicolon", but the semicolon is there? - Stack Overflow

I am getting a syntax error for missed semicolon.I do not see where I am missing one.I am new to codi

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
Add a ment  | 

1 Answer 1

Reset to default 3

Your 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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744967592a4603775.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信