2“风格” inline css img标签? [英] 2 "style" inline css img tags?
问题描述
我有以下标签
< img src =http://img705.imageshack.us/img705/ 119 / original120x75.pngstyle =height:100px;
style =width:100px; alt =25/>
我在
中添加了两个倾斜的CSS命令 style =width:100px;
style =height:100px;
由于某些原因,图片高度为100px,
我假设这是因为你不能在同一个标签中的一行中写这两个。
如果这是真的,是否有一种方法来同时指定高度和宽度?
我已经在我的外部CSS分配了不同的图像大小,我不认为你可以在 div中添加
在外部CSS的标记属性。 img
属性
感谢
您不需要2个样式属性 - 只需使用一个:
< img src =http://img705.imageshack.us/img705/119/original120x75.png
style =height: 100px; width:100px; alt =25/>但是,请考虑使用CSS类:
$ b b CSS:
.100pxSquare
{
width:100px;
height:100px;
}
HTML:
< img src =http://img705.imageshack.us/img705/119/original120x75.png
class =100pxSquarealt =25/> ;
I have the following tag
<img src="http://img705.imageshack.us/img705/119/original120x75.png"style="height:100px;"
style="width:100px;" alt="25"/>
I have put two incline CSS commands in
style="width:100px;"
style="height:100px;"
For some reason the picture has 100px height but no width.
I assume this is because you can't write two of these in a row in the same tag.
If this is true, is there a way to assign both the height and width?
I have already assigned a different image size on my external CSS, and I don't think you can add img
properties in the div
tag properties on the external CSS.
thanks
解决方案 You don't need 2 style attributes - just use one:
<img src="http://img705.imageshack.us/img705/119/original120x75.png"
style="height:100px;width:100px;" alt="25"/>
Consider, however, using a CSS class instead:
CSS:
.100pxSquare
{
width: 100px;
height: 100px;
}
HTML:
<img src="http://img705.imageshack.us/img705/119/original120x75.png"
class="100pxSquare" alt="25"/>
这篇关于2“风格” inline css img标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!