简体   繁体   中英

How to fix syntax error, "Missed semicolon", but the semicolon is there?

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%;
}

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM