【问题标题】:Bootstrap css is not compatible with my codeBootstrap css 与我的代码不兼容
【发布时间】:2017-01-30 07:12:06
【问题描述】:

我正在尝试通过关注此网站来构建具有垂直标题的表格:http://codepen.io/chriscoyier/pen/Fapif

我也使用引导 css。

问题是引导 css 与前面的示例不兼容: https://jsfiddle.net/arj0k0j8/

我的代码是:

<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <title>
            Newsletter generator v2
        </title>
        <style>
.table-header-rotated {
  border-collapse: collapse;
}
.table-header-rotated td {
  width: 30px;
}
 .table-header-rotated th {
  padding: 5px 10px;
}
.table-header-rotated td {
  text-align: center;
  padding: 10px 5px;
  border: 1px solid #ccc;
}
 .table-header-rotated th.rotate {
  height: 140px;
  white-space: nowrap;
}
 .table-header-rotated th.rotate > div {
  -webkit-transform: translate(25px, 51px) rotate(315deg);
      -ms-transform: translate(25px, 51px) rotate(315deg);
          transform: translate(25px, 51px) rotate(315deg);
  width: 30px;
}
 .table-header-rotated th.rotate > div > span {
  border-bottom: 1px solid #ccc;
  padding: 5px 10px;
}
.table-header-rotated th.row-header {
  padding: 0 10px;
  border-bottom: 1px solid #ccc;
}
    </style>
        <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">
        <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    </head>
    <body>
        <div class="container" id="container">
    <table class="table table-header-rotated">
  <thead>
    <tr>
      <!-- First column header is not rotated -->
      <th></th>
      <!-- Following headers are rotated -->
      <th class="rotate"><div><span>Column header 1</span></div></th>
        <th class="rotate"><div><span>Column header 2</span></div></th>
        <th class="rotate"><div><span>Column header 3</span></div></th>
        <th class="rotate"><div><span>Column header 4</span></div></th>
        <th class="rotate"><div><span>Column header 5</span></div></th>
        <th class="rotate"><div><span>Column header 6</span></div></th>
    </tr> 
  </thead>
  <tbody>
    <tr>
      <th class="row-header">Row header 1</th>
      <td><input checked="checked" name="column1[]" type="radio" value="row1-column1"></td>
      <td><input checked="checked" name="column2[]" type="radio" value="row1-column2"></td>
      <td><input name="column3[]" type="radio" value="row1-column3"></td>
      <td><input name="column4[]" type="radio" value="row1-column4"></td>
      <td><input name="column5[]" type="radio" value="row1-column5"></td>
      <td><input name="column6[]" type="radio" value="row1-column6"></td>
    </tr>
    <tr>
      <th class="row-header">Row header 2</th>
      <td><input name="column1[]" type="radio" value="row2-column1"></td>
      <td><input name="column2[]" type="radio" value="row2-column2"></td>
      <td><input checked="checked" name="column3[]" type="radio" value="row2-column3"></td>
      <td><input checked="checked" name="column4[]" type="radio" value="row2-column4"></td>
      <td><input name="column5[]" type="radio" value="row2-column5"></td>
      <td><input name="column6[]" type="radio" value="row2-column6"></td>
    </tr>
    <tr>
      <th class="row-header">Row header 3</th>
      <td><input name="column1[]" type="radio" value="row3-column1"></td>
      <td><input name="column2[]" type="radio" value="row3-column2"></td>
      <td><input name="column3[]" type="radio" value="row3-column3"></td>
      <td><input name="column4[]" type="radio" value="row3-column4"></td>
      <td><input checked="checked" name="column5[]" type="radio" value="row3-column5"></td>
      <td><input checked="checked" name="column6[]" type="radio" value="row3-column6"></td>
    </tr>
  </tbody>
</table>
    </div>
    </body>
</html>

当我删除这一行时:

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel="stylesheet">

一切正常

【问题讨论】:

  • 您必须使用 Web 控制台调试工具来尝试查找未正确显示的元素,然后跟踪哪些样式规则导致冲突,然后从那里开始工作

标签: html css twitter-bootstrap html-table


【解决方案1】:

只需从您的表中删除 Bootstrap .table 类..

&lt;table class="table-header-rotated"&gt;

http://codeply.com/go/V8djT7SOzD

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-11-28
    • 2012-08-19
    • 1970-01-01
    • 2020-03-19
    • 2019-02-16
    • 2023-03-15
    • 2016-07-12
    • 1970-01-01
    相关资源
    最近更新 更多