html - 图像被切断的CSS

标签 html twitter-bootstrap css responsive-design

我在页面上有一张图片从底部被截断了。我有

html, body {
    max-width: 100%;
    overflow-x: hidden;

}
.image_button{
    border-radius: 20px;
    border: 5px solid #d3d3d3;
    float: left;
    margin-right:20px;
}
 image-responsive is present in bootstrap.
text-center is in bootstrap

在我的代码中,但这只是为了避免页面上的横向滚动。有什么方法可以避免侧滚动以及不从底部剪切图像吗?

    <div id="gender" style="visibility: hidden ;" >
                           <h4 style="left: 20%; top: 10%;position: absolute; " class="text-center" ><b>Click on the female or male figure to select a gender.</b></h4>
                           <div style="left: 20%; top: 20%;position: absolute;" >
                           <img id="man" src="images/man.png"  onClick="pg4('bh'); sess2('gender male');" class="img-responsive image_button">
                           <img id="woman" src="images/woman.png" onClick="pg4('bh'); sess2('gender female');" class="img-responsive image_button">
                                                           <h4 style="left: 19%; top: 100%;position: absolute;" class="text-center" >Male</h4>
                           <h4 style="left: 67%; top: 100%;position: absolute;" class="text-center" >Female</h4>
                           </div>
        </div>

The base of the image gets cut, and it is not because of class "image_buttom"

最佳答案

将此添加到您的 CSS:

img {
    width: 100%;
    height: auto;
}

为图像添加一个唯一的类名,并将 img 替换为该名称,以确保上述样式属性不会应用于您网站上的其他图像。

关于html - 图像被切断的CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42445899/

相关文章:

html - 隐藏的用户如何点击输入字段?

html - 在CSS中与 parent 和 child 一起徘徊

css - 使用 CSS 的菜单项的透视焦点(灰色其他元素并突出显示当前元素)

javascript - 将文本添加到 onKeyPress react.js 的文本输入中

javascript - 使用 html 数据属性设置要显示的 block 数量

html - 如何隐藏比其父元素大的子元素的一部分?

css - Bootstrap 样式表的正确顺序

css - 将硬编码菜单传输到 wordpress 并应用样式

css - Twitter Bootstrap - 列未对齐

css - 方括号中的 "i"在 CSS 选择器中有什么作用?