html - Bootstrap : Thumbnail is creating horizontal overflow

标签 html css twitter-bootstrap responsive-design web-deployment

我已经尝试修复这个问题 2 个小时了,我什至重写了整个网站,只是为了看看是什么造成了溢出,并且刚刚意识到,当我添加我的“缩略图”组件时,它创建了一个水平溢出,这确实是令人沮丧。

这是我网站的精简版,尝试删除缩略图部分,您会发现一切正常。但随之而来的是溢出。

这是怎么回事?

http://codepen.io/kreitzo/pen/QyoRMx

index.html

<!DOCTYPE html>
<html lang="en">

<head>
  <title>Kreitzo</title>

  <link rel="shortcut icon" href="http://www.yoursite.com/favicon.ico?v=2" />

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="author" content="William Kreitz">

  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  <script src="./js/script.js"></script>
  <script src="typed.js"></script>

  <link href="css/bootstrap.css" rel="stylesheet">
  <link href="css/styles.css" type="text/css" rel="stylesheet" />

</head>

<body>
  <main>
    <nav>
      <div id="nav_wrapper">
        <ul>
          <li><a href="#">Home</a>
          </li>
          <li><a href="#">About me</a>
          </li>
          <li><a href="#">Work</a>
          </li>
          <li><a href="#">Contact</a></li>
        </ul>
      </div>
    </nav>
    <header>
      <div class="jumbotron">
        <div class="container">
          <h1>Hey everyone!</h1>
          <div class="applist_wrapper">
            <p id="subject_title">Download my</p>
            <p id="subjects" class="type-wrap"><span id="typed">Hello?</span></p>
          </div>
        </div>
      </div>
    </header>


    <section>
      <div class="row">
        <div class="thumbnail"></div>
      </div>
    </section>

    <footer>
      <div class="container">
        <div class="row">
          <div class="col-xs-12">
            <ul class="list-inline">
              <li><a href="#">Home</a>
              </li>
              <li><a href="#">About me</a>
              </li>
              <li><a href="#">Work</a>
              </li>
              <li><a href="#">Contact</a></li>
            </ul>
          </div>
          <div class="col-xs-12">
            <p id="copyright">Copyright © WK 2016. All Rights Reserved</p>
          </div>
        </div>
      </div>
    </footer>


  </main>
  <script src="js/bootstrap.js"></script>


</body>

</html>

样式.css

/* Fonts */

@import url(https://fonts.googleapis.com/css?family=Quicksand:400,300);

/* Body */

html,
body {
  padding: 0;
  margin: 0;
  font-family: 'Quicksand', sans-serif;
}


/* Nav */

nav {
  background-color: #232323;
  top: 0;
  position: fixed;
  width: 100%;
}

#nav_wrapper {
  text-align: center;
}

nav ul {
  margin: 0;
  padding: 0;
}

nav ul li {
  list-style-type: none;
  display: inline-block;
  padding: 15px;
  -webkit-transition: background-color 0.5s;
  /* Safari */
  transition: background-color 0.5s;
}

nav ul li a {
  text-decoration: none;
  margin-right: 20px;
  margin-left: 20px;
  color: white;
  text-transform: uppercase;
  -webkit-transition: background-color 0.5s;
  /* Safari */
  transition: background-color 0.5s;
}

@media (min-width:400px) {
  nav ul li a {
    margin: 0;
  }
  ;
}

nav ul li:hover {
  background-color: #5d4037;
  cursor: pointer;
}

nav ul li:hover a {
  color: whitesmoke;
  text-decoration: none;
}


/* Jumbotron */

.jumbotron {
  margin-top: 50px;
}

.title {
  text-transform: uppercase;
  text-align: right;
  padding: 0;
}

.jumbotron {
  background: url(../images/DeathtoStock_Wired7.jpg) center center no-repeat;
  background-size: 100% auto;
  height: 500px;
}

.jumbotron .container {
  text-align: right;
}


/* About */

#about {
  margin-bottom: 120px;
}

.spacing {
  margin-bottom: 50px;
}


/* App thumbnails */

.thumbnail {
  color: #747704;
  margin: 0;
}

.thumbnail img {
  height: 250px;
  width: 250px;
  border-radius: 30px;
}

.thumbnail h3 {
  text-transform: uppercase;
}

.image:hover {
  -webkit-box-shadow: 0px 0px 20px 5px rgba(0, 185, 233, .75);
  box-shadow: 0px 0px 20px 5px rgba(0, 185, 233, .75);
}

.image {
  -webkit-transition: all 0.7s ease;
  transition: all 0.7s ease;
}


/* Footer */

footer {
  background-color: #232323;
  padding: 50px;
}

footer a {
  color: white;
  text-transform: uppercase;
  font-size: 10px;
  -webkit-transition: color 0.5s;
  /* Safari */
  transition: color 0.5s;
}

footer a:hover {
  color: #5d4037;
  text-decoration: none;
}

footer #copyright {
  color: dimgray;
}


/* application list autotyper */

.applist_wrapper p {
  margin: 0;
  padding: 0;
  margin-left: 20px;
  font-size: 40px;
  display: inline-block;
  line-height: 80px;
  vertical-align: top;
}

@media (min-width:320px) {
  .applist_wrapper p {
    font-size: 20px;
  }
  ;
}

@media (min-width:481px) {
  .applist_wrapper p {
    font-size: 30px;
  }
  ;
}

@media (min-width:641px) {
  .applist_wrapper p {
    font-size: 35px;
  }
  ;
}

#typed {
  color: yellow;
}


/* cursor blinker */

.typed-cursor {
  color: yellow;
  opacity: 1;
  -webkit-animation: blink 1s infinite;
  -moz-animation: blink 1s infinite;
  animation: blink 1s infinite;
}

@keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
  ;
}

@-webkit-keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
  ;
}

@-moz-keyframes blink {
  0% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
  ;
}

最佳答案

在你的行标签前添加一个容器:

<section>
    <div class="container">
        <div class="row">
            <div class="thumbnail"></div>
        </div>
    </div>
</section>

因为容器会自动为您提供 padding 和 margin 参数。

关于html - Bootstrap : Thumbnail is creating horizontal overflow,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35436863/

相关文章:

javascript - 根据窗口大小动态调整图像缩略图,全出血

css - 如何使 Bootstrap 下拉列表始终位于顶部

html - Twitter Bootstrap 的文本输入呈现问题

javascript - HTML5 Canvas 动画不显示背景图像

html - 如何解决IE6中的select overlap bug?

php - 使用括号时 CSS 背景图像 url 不起作用

python - 如何与合作伙伴分享我正在开发的网站?

javascript - Javascript 中的动态下拉菜单与 onchange

javascript - jQuery 克隆表行但页面上有多个表

html - IE 上的 Css 条件