简体   繁体   English

图像尺寸问题,宽度和高度不起作用

[英]Image size issue, width and height not working

This is the style: style="width:30px;height:30px; which I tried and other CSS to an image, but stays original size?这是样式: style="width:30px;height:30px;我试过和其他 CSS 到图像,但保持原始大小?

Maybe the image size is being overridden somewhere else.也许图像大小在其他地方被覆盖。 To counter this,为了应对这种情况,

style="width: 30px;important:height; 30px !important;"样式=“宽度:30px;重要:高度;30px!重要;”

The !important specifies that the property given should override any other class property or image property !important 指定给定的属性应覆盖任何其他 class 属性或图像属性

Try to write the code in body instead of style and see does it works or not.尝试用正文而不是样式编写代码,看看它是否有效。

There is a possibility that your CSS might be getting overridden with any other CSS, to deliberate your CSS you can use !important For ex您的 CSS 可能会被任何其他 CSS 覆盖,以考虑您可以使用的 CSS !

style="width: 30px !important;height: 30px !important;"  

It would be better if you share your html and css code for this issue.如果您为此问题共享 html 和 css 代码会更好。

Directly use this in your img tag直接在你的 img 标签中使用它

width="30" height="30"宽度=“30”高度=“30”

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

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