简体   繁体   English

如何修复语法错误,“错过了分号”,但分号在那里?

[英]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.我正在尝试调整由 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如果您选择图像的src属性,请尝试

img[src] {
max-height: 25%;
max-width: 25%;
}

The above example will allow you to select any image with a src attribute.上面的示例将允许您选择具有src属性的任何图像。

If this does not remedy the problem, please post a larger chunk of your CSS.如果这不能解决问题,请发布更大的 CSS 块。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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