html - Bootstrap 列在移动设备上重叠文本

标签 html css twitter-bootstrap

我是 Bootstrap 的新手(不到一周的经验),我遇到了一个恼人的小问题。调整大小时,其中一列中的文本开始在其下方的列下方滑动。我尝试将文本放在它自己的容器中,并将所有容器从 .container-fluid 更改为 .container,但似乎没有任何效果。

网站可以访问here相关代码片段如下

.table > tbody > tr > td {
    vertical-align: middle;
}
h1 {
    font-family: 'Great Vibes', Helvetica, sans-serif;
    font-size: 50px;
    color: white;
}
.table > tbody > tr:hover {
    background-color: #333333;
}
<div class="col-sm-7" style="background-color: #111313; height: 600px; color: white; min-height: 500px; margin-bottom: 20px">
  <h1 style="text-align: center;">Sara Manning<br/> Orchestra</h1>
  <iframe class="img-responsive center-block" style="height: 60%; width: 75%" src="https://www.youtube.com/embed/rOjHhS5MtvA" frameborder="0" allowfullscreen></iframe>
  <hr/>
  <p style="word-wrap: break-word; margin-bottom: 40px; width: 75%; margin: auto;">   The Sara Manning Orchestra is a highly trained group of musicians from all over the world. Our orchestra consists of nearly 80 world renowned musicians. Our conductor, Sara Manning, is skilled enough to have conducted The London Symphony Orchestra when their conductor called in sick. Our musicians are really good too. We've got those guys that play those things with the strings, and some girls who play those big metal tubes you blow on.
    <br/>
  </p>
</div>
<div class="col-sm-5" style="background-color: black; min-height: 600px; color: white; border-top-left-radius: 20px; border-bottom-left-radius: 20px;">
  <h2 style="text-align: center">Upcoming Tourdates</h2>
  <table class="table">
    <thead>
      <th>Location</th>
      <th>Date</th>
      <th>Ticket Info</th>
    </thead>
    <tbody>
      <tr>
        <td>
          The Kentucky Theatre 
          <p class="text-muted">Lexington, KY</p>
        </td>
        <td>Oct. 22</td>
        <td><button class="btn btn-primary">Get Tickets</button></td>
      </tr>
      <tr>
        <td>
          The Civic Auditorium
          <p class="text-muted">Knoxville, TN</p>
        </td>
        <td>Oct. 31</td>
        <td><button class="btn btn-primary">Get Tickets</button></td>
      </tr>
      <tr>
        <td>
          The Sydney Opera House
          <p class="text-muted">Sydney, New South Wales, Australia</p>
        </td>
        <td>Nov. 30</td>
        <td>
          <h3 class="text-danger">Sold Out</h3>
        </td>
      </tr>
      <tr>
        <td>
          Bob's House of Music 'n Stuff
          <p class="text-muted">An Undisclosed Basement In Queens, NY</p>
        </td>
        <td>Dec. 25</td>
        <td><button class="btn btn-primary">Get Tickets</button></td>
      </tr>
      <tr>
        <td>
          Batman's Cave
          <p class="text-muted">Gotham, USA</p>
        </td>
        <td>Dec. 31</td>
        <td>
          <h3 class="text-danger">Sold Out</h3>
        </td>
      </tr>
    </tbody>
  </table>
</div>
</div>

最佳答案

col-sm-7 中删除 height: 600px;。也许你想要一个 min-height?由于您强制它始终为 600px 高,因此当 col-sm-7 中的内容超过 600px 时,它下面的 div 将与它重叠。

.table > tbody > tr > td {
    vertical-align: middle;
}
h1 {
    font-family: 'Great Vibes', Helvetica, sans-serif;
    font-size: 50px;
    color: white;
}
.table > tbody > tr:hover {
    background-color: #333333;
}
<!-- remove height: 600px; -->
<div class="col-sm-7" style="background-color: #111313; color: white; min-height: 500px; margin-bottom: 20px">
  <h1 style="text-align: center;">Sara Manning<br/> Orchestra</h1>
  <iframe class="img-responsive center-block" style="height: 60%; width: 75%" src="https://www.youtube.com/embed/rOjHhS5MtvA" frameborder="0" allowfullscreen></iframe>
  <hr/>
  <p style="word-wrap: break-word; margin-bottom: 40px; width: 75%; margin: auto;">   The Sara Manning Orchestra is a highly trained group of musicians from all over the world. Our orchestra consists of nearly 80 world renowned musicians. Our conductor, Sara Manning, is skilled enough to have conducted The London Symphony Orchestra when their conductor called in sick. Our musicians are really good too. We've got those guys that play those things with the strings, and some girls who play those big metal tubes you blow on.
    <br/>
  </p>
</div>
<div class="col-sm-5" style="background-color: black; min-height: 600px; color: white; border-top-left-radius: 20px; border-bottom-left-radius: 20px;">
  <h2 style="text-align: center">Upcoming Tourdates</h2>
  <table class="table">
    <thead>
      <th>Location</th>
      <th>Date</th>
      <th>Ticket Info</th>
    </thead>
    <tbody>
      <tr>
        <td>
          The Kentucky Theatre 
          <p class="text-muted">Lexington, KY</p>
        </td>
        <td>Oct. 22</td>
        <td><button class="btn btn-primary">Get Tickets</button></td>
      </tr>
      <tr>
        <td>
          The Civic Auditorium
          <p class="text-muted">Knoxville, TN</p>
        </td>
        <td>Oct. 31</td>
        <td><button class="btn btn-primary">Get Tickets</button></td>
      </tr>
      <tr>
        <td>
          The Sydney Opera House
          <p class="text-muted">Sydney, New South Wales, Australia</p>
        </td>
        <td>Nov. 30</td>
        <td>
          <h3 class="text-danger">Sold Out</h3>
        </td>
      </tr>
      <tr>
        <td>
          Bob's House of Music 'n Stuff
          <p class="text-muted">An Undisclosed Basement In Queens, NY</p>
        </td>
        <td>Dec. 25</td>
        <td><button class="btn btn-primary">Get Tickets</button></td>
      </tr>
      <tr>
        <td>
          Batman's Cave
          <p class="text-muted">Gotham, USA</p>
        </td>
        <td>Dec. 31</td>
        <td>
          <h3 class="text-danger">Sold Out</h3>
        </td>
      </tr>
    </tbody>
  </table>
</div>

关于html - Bootstrap 列在移动设备上重叠文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46458357/

相关文章:

css - SASS 放置双重属性名称,为什么?

php - 如果用户更改了只应在登录后出现的隐藏元素的 css 怎么办?

html - 更改 Bootstrap 下拉以向右水平放置

javascript - jQuery 选择器适用于 Javascript 代码之后出现的选择器吗?

html - 手机上的 JSF 应用程序 - 不在 div 中滚动

html - 如何为具有相同分辨率的不同设备提供相同网址的不同 View ?

java - Android:我怎么知道CSS注入(inject)完成了?

html - 为 css 中的链接强制执行本地样式的类

html - Box Div 顺序错误

html - 无法将样式应用于 safari 中的标签 pre