Image 响应图像,CSS边距顶部和底部以像素为单位固定?

Image 响应图像,CSS边距顶部和底部以像素为单位固定?,image,css,margin,fixed,Image,Css,Margin,Fixed,我试过了,但没用。。我希望图像按比例更改其大小,但页边距顶部和页边距底部以像素为单位固定 #imagenslide img { margin-top: 100px; margin-bottom: 100px!important; width: auto; height: auto; position: relative; } 需要帮忙吗?谢谢 使用 #imagenslide img { margin-top: 100px; marg

我试过了,但没用。。我希望图像按比例更改其大小,但页边距顶部和页边距底部以像素为单位固定

#imagenslide img {

    margin-top: 100px;
    margin-bottom: 100px!important;
    width: auto;
    height: auto;
    position: relative;

}
需要帮忙吗?谢谢

使用

#imagenslide img {

    margin-top: 100px;
    margin-bottom: 100px!important;
    width: 100%;
    height: auto;
    position: relative;

}
或者也可以使用
minwidth
css属性。。
另外,请尝试使用%宽度表示响应速度。

我认为您的回答很接近,但我认为这比您想象的要简单。尝试:

<img id="imagenslide"src="http://placehold.it/350x150">

#imagenslide { 
    margin: 100px 0;
    display: block;
    position: relative;
}

#imagenslide{
利润率:100px0;
显示:块;
位置:相对位置;
}

CSS没有HTML是没有用的,请也创建一个提琴。这就是你想要实现的吗?谢谢,但它不起作用。这是一个网站和一个图像,我正试图集中(页边顶部和页边底部150px),谢谢,但它不工作。我评论了第一篇文章。这是网站www.pepapoch.testlink的链接。es@AbelAbad将此css用于图像的边距顶部:150px 20%240px!重要的;宽度:60%;高度:自动您不需要在此图像上保持“位置:固定”。此外,在纠正位置和宽度之后,请为其父div定义适当的宽度。这样,在将所有div按适当的层次排列之前,图像相应地采用其父div的“宽度”。现在它不是按顺序排列的..或者如果出于某种原因您仍然想使用'position:fixed',那么请从中删除边距,并使用'top''left'css属性调整其位置..谢谢。我认为利润底部被忽略是因为宽度:60%。。。仍然没有解决。