html - 如何防止 Bootstrap 和列表中的水平滚动?

标签 html css twitter-bootstrap horizontal-scrolling

我有一个响应式 UL List ,许多 Li ImageItem 和 span 都在这个 UL 中。 在最大化尺寸时,3 个元素显示在一行中,当我调整(小)我的浏览器时,2 个元素显示并且工作正常。但是在我的浏览器的最小尺寸中出现水平滚动 :( 1 项显示但滚动出现,我如何防止水平滚动?! 这是我的 CSS :

.myUl {
    font-size:large !important;
    color:#373636 !important;
    text-align:center !important;
}
.myUl li {
    width:350px !important;
}
.myUl li:hover {
    background:rgba(0, 0, 0, 0.2) !important;
}
.myUl li img {
    height:170px !important;
    width:100px !important;
}
.myUl li span {
    float:right !important;
    width:170px;
    padding-right:8px !important;
    padding-top:10px !important;
    text-align:right !important;
    vertical-align:middle !important;
    line-height: 1.5em !important;
}
ul.img-list {
    list-style-type: none;
    margin: 0;
    padding: 0;
    text-align: center;
}
ul.img-list li {
    display: inline-block;
    height: 180px;
    margin: 0 1em 1em 0;
    position: relative;
    width: 150px;
}
ul.img-list li:hover span.text-content {
    opacity: 1;
}

这是我的 Index.cshtml

<div>
    <ul class="img-list myUl">
        <li>
            <span>
                some text here
            </span>
            <span style="float: left !important; padding-top: 3px !important;">
                <a>
                    <img class="img-responsive img-circle img-thumbnail" src="~/Images/MenuImages/z.jpg"  />
                </a>
            </span>
        </li>
        <li>
           .........
        </li>
  </ul>

我页面的图片

最佳答案

为了防止水平滚动,只需将其添加到 Css 中的 body 标签中即可:

body {
    overflow-x: hidden;
}

希望对您有所帮助

关于html - 如何防止 Bootstrap 和列表中的水平滚动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33864615/

相关文章:

html - 是否可以在不影响正文滚动条的站点上设置 div?

javascript - iPhone 的点击和鼠标移动?

jquery - 限制 HTML 中的用户输入

css - 如何阻止我的 Feedback Div 停止改变屏幕分辨率的位置?

html - 电子邮件 html 框架? (又名电子邮件 Bootstrap )

ruby-on-rails - Capybara/Cucumber 无法点击 twitter bootstrap rails 应用程序中的链接/按钮

html - 图像未随脚本一起加载

javascript - 基于点击功能的toggleClass

python - Gtk.CssProvider() 基于 ID 的选择器如何在 Gtk3 中工作?

twitter-bootstrap - twitter bootstrap 的开源管理主题