gpt4 book ai didi

html - Bootstrap 4 布局帮助 - 让列扩展到正确的高度

转载 作者:行者123 更新时间:2023-11-28 00:59:30 25 4
gpt4 key购买 nike

所以我正在尝试设计一个网站。第一次使用 bootstrap 时,我无法正确编辑高度,感觉就像是从头开始学习编码一样。 (我中断了几年。)

我试图让页面在上面的平板电脑上看起来像这样(纵向大小)

上方纵向尺寸:

enter image description here

我的大尺寸目标是让主体占据窗口的大约 80%,页脚/页眉占据其余空间。

并尝试让它在平板电脑(纵向)和更小的设备上看起来像这样:

低于纵向尺寸:

enter image description here

我对这个的目标不仅仅是让它下降到图像下方并使其可以滚动。

现在我的代码是这样的:

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="">
<meta name="keywords" content="">
<title>The Last Names</title>
<link rel="stylesheet" href="css/bootstrap4.min.css">
<link rel="stylesheet" href="css/main.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>
</head>

<body>

<nav class="navbar navbar-expand-md bg-dark navbar-dark">
<a class="navbar-brand" href="#">Caitlyn &amp; Jacob Team Up</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="collapsibleNavbar">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About Us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">The Bridal Party</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">RSVP</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Registry</a>
</li>
</ul>
</div>
</nav>

<div class="container-fluid">
<div class="row">

<!-- Pictures will go here -->
<div class="picmain col-12 col-md-6 bg-primary">
<h3>pics here</h3>
</div>

<!-- Info column row -->
<div class="col-12 col-md-6">
<div class="row">

<!-- info 1 -->
<div class="info1 col-12 bg-secondary">
<h3>info1</h3>
</div>

<!-- info 2 -->
<div class="info2 col-12 bg-info">
<h3>info2</h3>
</div>

</div>
</div>

</div>

<div class="row">
<div class="footer col-12">Footer stuff will go here</div>
</div>

</div>

</body>

</html>

谁能帮我弄清楚我需要做什么才能实现我的期望?谢谢:)

最佳答案

你可以在主体上做的是创建一个包含两列的行,并在第二列中嵌套 2 行(每行都有一个类“col”)。检查此笔示例`

 <!--General Row starts here --> 
<div class="row">
<!--first column starts here -->
<div class="col-md one ">
<h1>Column </h1>
</div>
<!--first column ends here -->
<!--second column starts here -->
<div class="col-md">
<!--first nested row starts here -->
<div class="row">
<div class="col two">
<h1> first Nested row with "col" class</h1>
</div>
</div>
<!--first nested row ends here -->
<!--second nested row starts here -->
<div class="row">
<div class="col three">
<h1> second Nested row with "col" class </h1>
</div>
</div>
<!--second nested row ends here -->
</div>
</div>

</div>

` https://codepen.io/stevegates/pen/MPmRBp并查看引导文档以获取有关引导网格的更多信息 https://getbootstrap.com/docs/4.1/layout/grid/

关于html - Bootstrap 4 布局帮助 - 让列扩展到正确的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52755463/

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