html - 尝试使用类似于此的 HTML 和 CSS 对网格进行编码

标签 html css bootstrap-grid

我正在尝试制作一个列出不同专业的网格,与此类似但我想要 3 列而不是 4 列... grid similar to this

到目前为止,我正在尝试使用它,但填充确实关闭了,因为每个按钮根据内部单词的大小需要不同的填充。所以使用这段代码,输出看起来像这样......(ps.bootstrap 是链接的,所以没有问题)

<!doctype html>

<html lang="en">
<head>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
</head>


<body style="background-color:white">
   <!-- heading -->
  <div class="container-fluid">
    <div class="tab">
      <div class="row">
        <div class="col">
      <button class="tablinks" onclick="openTab(event, 'Button1')">Accounting and Information Systems</button>
        </div>
        <div class="col">
      <button class="tablinks" onclick="openTab(event, 'Button2')">African Studies</button>
        </div>
        <div class="col">
      <button class="tablinks" onclick="openTab(event, 'Button3')">American Indian Studies</button>
        </div>
      </div>
      <div class="row">
        <div class="col">
      <button class="tablinks" onclick="openTab(event, 'Button1')">Anthropology</button>
        </div>
        <div class="col">
      <button class="tablinks" onclick="openTab(event, 'Button2')">Art</button>
        </div>
        <div class="col">
      <button class="tablinks" onclick="openTab(event, 'Button3')">Asian American Studies</button>
        </div>
      </div>
    </div>
  </div>
</body>
</html>

output of the HTML provided above

最佳答案

检查 <div clas="col"> 中类的拼写

您可能需要考虑使用 html table因为它是为您在这种情况下要执行的操作而设计的,并且当您减小屏幕宽度时,单元格不会换行。

关于html - 尝试使用类似于此的 HTML 和 CSS 对网格进行编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49205430/

相关文章:

html - IE7 下拉菜单让 li 填充剩余空间

javascript - 如何更改 Bootstrap 内联日期选择器以适应全宽

JavaScript 错误 : Uncaught TypeError: Cannot read property 'left' of undefined

php - 在同一页面上激活实现 css 表单?

html - 在 Bootstrap css 网格中展开列移动其他列

html - 在断点上使用 Bootstrap 4 的网格自动调整列大小时,一旦浏览器变小,它们就会被永久忽略

html - 在 bootstrap 中对列重新排序以获得更大的显示

html - 如何更改另一个 <p> 标签下的 div 类中的 <p> 标签的颜色?

html - 使用全屏时,css border-bottom 属性在 Chrome 中不起作用

java - 如何以及在何处将上传的图像放置在 glassfish 4 上