css - 对于 Bootstrap 4 站点,我应该在 body 还是 main 级别添加 container-fluid

标签 css twitter-bootstrap bootstrap-4

对于 Bootstrap 4 站点,我应该在 body 还是 main 级别添加 container-fluid

<html>
<head></head>
<body class= "container-fluid">
<header></header>
<main></main>
<footer></footer>
</body>
</html>

<html>
<head></head>
<body>
<header></header>
<main class= "container-fluid"></main>
<footer></footer>
</body>
</html>

什么会更常见?

第二,通常每个部分都有一个容器, 即

<html>
<head></head>
<body>
<header class= "container-fluid"></header>
<main class= "container-fluid"></main>
<footer class= "container-fluid"></footer>
</body>
</html>

最佳答案

第一: 在我看来,容器是某种东西,它是子主体部分,可以在页面上出现多次。顺便说一句,我看不到使用页眉、主要和页脚 block 的好处。但在你的情况下我会这样做:

<html>
<head></head>
<body>
<header></header>
<main>
    <div class="container-fluid"></div>
    <div class="container-fluid"></div>
</main>
<footer></footer>
</body>
</html>

Ad.: 一些 css 框架对元素页眉、主体、页脚有一些样式。在这种情况下,您应该检查这些元素。

第二:我认为这不是个好主意。至少 不能有样式。其他元素,如 header、main 和 footer 通常与 div 一样工作,因此您可以向它们添加类。

关于css - 对于 Bootstrap 4 站点,我应该在 body 还是 main 级别添加 container-fluid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50467751/

相关文章:

html - 通过单击另一个更改 html 标记的样式

css - next.js 使用现在缺少的样式部署,styles.css 404 响应

html - Bootstrap div 拉伸(stretch)到页面底部

css - Bootstrap 4 alpha 6 - 行内卡片行为

html - Bootstrap 导航栏展开无法正常工作

javascript - 为什么 bootstrap 4 slider 工作不顺畅?

javascript - 为什么在 html2canvas 的顶部有一个空白区域?

html - 为所需星号添加跨度时 Bootstrap 输入组插件对齐问题

css - Bootstrap with DataTable 集成设计问题 PHP

css - 获取 CSS3 过渡以更改为动态高度