我正在尝试做一个网站,但我不能设置一张照片的宽度和高度。在浏览器中,图像有一个大小,但在另一个浏览器中有另一个one.What,我该怎么办?
<div id ='start'>
<img id = 'profil-img'src="images (1).jpg" alt="castronel" width="200"
height="250">
</div>和css
#profil-img {
display: inline-block;
margin-right:10px;
}在Mozilla上

关于铬

发布于 2020-12-28 16:54:49
使所有属性的引号相同,并在id和src之间添加空格
<img id ="profil-img" src="images (1).jpg" alt="castronel" width="200" height="250">而不是
<img id = 'profil-img'src="images (1).jpg" alt="castronel" width="200" height="250">你可以直接在css上添加高度,宽度
#profil-img {
display: inline-block;
margin-right:10px;
width:200px;
height:250px;
}发布于 2020-12-28 16:46:04
既然您使用的是id标记#profil-img,那么为什么不使用css来声明它,而不是在html中声明宽度和高度。除了类之外,id标签也是唯一的。
#profil-img {
display:inline-block;
margin-right:10px;
max-width:100%;
width:200px;
height:250px;
}发布于 2020-12-28 17:53:30
尝尝这个
<div id="start">
<img id="profil-img" src="images(1).jpg" alt="castronel" width="200"height="250">
</div>您也可以直接在css中使用它
#profil-img{
display:inline-block;
margin-right:10px;
width:200px;
height:250px;
}https://stackoverflow.com/questions/65474946
复制相似问题