gpt4 book ai didi

css - Bootstrap 行宽

转载 作者:技术小花猫 更新时间:2023-10-29 11:51:51 24 4
gpt4 key购买 nike

我有以下 HTML:

<!DOCTYPE HTML>
<html>

<head>
<link rel="stylesheet" href="STYLE.css">
<link rel="stylesheet" href="bootstrap-3.3.5-dist/css/bootstrap.min.css">
</head>

<body>
<header class="row"></header>

<section class="row section1"></section>
<section class="row section2"></section>
<section class="row section1"></section>
<section class="row section2"></section>
<section class="row section1"></section>

<footer class="row"></footer>
</body>

</html>

由于某种原因,整个网页比浏览器窗口宽。当我删除 row 类时,一切都恢复正常。本地 CSS 文件与该问题无关。我的猜测是 bootstrap CSS 以某种方式修改了该行,使其由于某种原因变得更宽。所以我想问问是否有人有解决此问题的想法。

最佳答案

您可以使用 .container class 或 .container-fluid。.container 与实际屏幕保持一定的边距空间,并且不会拉伸(stretch)页面 View 。另一方面,.container-fluid 会尽可能地拉伸(stretch)页面。请参阅下面修改的 html 脚本:

<!DOCTYPE HTML>
<html>

<head>
<link rel="stylesheet" href="STYLE.css">
<link rel="stylesheet" href="bootstrap-3.3.5-dist/css/bootstrap.min.css">
</head>

<body>
<div class="container">
<header class="row"></header>
<section class="row section1"></section>
<section class="row section2"></section>
<section class="row section1"></section>
<section class="row section2"></section>
<section class="row section1"></section>

<footer class="row"></footer>
</div>
</body>

</html>

此外,您必须使用类似 .col-md-6 的类来指定行内部分的宽度,其中 md 也可由 lg 和 sm 替换。

md 代表中型设备,如笔记本电脑、台式机等

lg 代表大型设备,例如投影仪或一些更大的屏幕等。

sm 代表小型设备,例如手机等。

您可以自由组合使用这三者。例如,

<div class="container-fluid">
<div class="row">
<div class="col-md-6 col-sm-1 col-lg-12">

</div>
</div>
</div>

希望它能帮助您入门并解决您的问题。

关于css - Bootstrap 行宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33233611/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com