gpt4 book ai didi

html - 最后在超大屏幕中的 hr 行

转载 作者:太空宇宙 更新时间:2023-11-03 22:29:56 25 4
gpt4 key购买 nike

hr-line

我的超大屏幕上有 2 小时的线路。第一个在页面开头按照我的意愿正确对齐。 Logo 底部的那个应该在页面的末尾。我将 vh 高度设置为 100。

.jumbotron{
height: 100vh;

如何在最后对齐 hr?我尝试了类似 align-items-end 的方法,但这没有成功。

我正在使用 Bootstrap 4,html 如下所示:

    <!DOCTYPE html>
<html lang="de">

<head>
<!-- Wichtige Meta Daten -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- CSS
============================================================================================= -->

<!-- Bootstrap -->
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Montserrat|Spectral" rel="stylesheet">
<!-- Simple Line Icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/simple-line-icons/2.4.1/css/simple-line-icons.css">
<!-- Custom -->
<link rel="stylesheet" href="assets/css/style.css">
</head>

<body>

<header class="hero-bg">
<!-- Start Navigation -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top">
<div class="container m-auto nav-line">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-toggle" aria-controls="navbar-toggle" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse justify-content-center text-uppercase font-alt" id="navbar-toggle">
<ul class="navbar-nav mt-1">
<li class="nav-item">
<a href="#texting" class="nav-link">Texting</a>
</li>
<li class="nav-item">
<a href="#eventkonzeption" class="nav-link">Event Konzeption</a>
</li>
<li class="nav-item">
<a href="#impression" class="nav-link">Impressionen</a>
</li>
<li class="nav-item">
<a href="#ueber" class="nav-link">Über mich</a>
</li>
<li class="nav-item">
<a href="#kontakt" class="nav-link">Kontakt</a>
</li>
</ul>
<!-- navbar-nav -->
</div>
<!-- navbar-collapse -->
</div>
<!-- container -->
</nav>
<!-- Ende Navigation -->
</header>

<!-- Header -->
<section id="home" class="hero-bg jumbotron">
<div class="container pt-0 pb-5 header-h">
<hr style="background: white; justify-content-start">
<div class="align-items-start row justify-content-center">

<div class="img-logo col align-self-start">
<img class="img-fluid d-block img-responsive" src="resources/img/logo.png" alt="Rollywood-Logo" >
</div>
<!-- col -->
</div>

<!-- row -->
<hr class="align-self-end" style="background: white;">

</div>

<!-- container -->
</section>
<!-- Header -->

<!-- jQuery -->
<script src="assets/js/jquery-3.2.1.min.js"></script>
<!-- Popper -->
<script src="assets/js/popper.min.js"></script>
<!-- Bootstrap -->
<script src="assets/js/bootstrap.min.js"></script>
<!-- Custom -->
<script src="assets/js/custom.js"></script>

</body>

</html>

最佳答案

要解决这个问题(同时将 <hr> 元素保留在超大屏幕内),添加类 d-flex flex-column h-100到超大屏幕内的容器,然后添加 mt-auto类 (margin-top:auto) 和可选的 mb-0 class (margin-bottom:0) 到最后<hr>元素。

d-flex flex-column类启用 flexbox 列和 h-100给它 100% 的高度。 mt-auto<hr> 上然后将其向下推。通过 pb-*容器上的类,然后您可以控制 <hr> 距底部多远坐。在这种情况下,我选择了 pb-4 .

点击下面的“运行代码片段”并展开到整页进行测试:

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

<header class="hero-bg">
<!-- Start Navigation -->
<nav class="navbar navbar-expand-md navbar-dark fixed-top">
<div class="container m-auto nav-line">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-toggle" aria-controls="navbar-toggle" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>

<div class="collapse navbar-collapse justify-content-center text-uppercase font-alt" id="navbar-toggle">
<ul class="navbar-nav mt-1">
<li class="nav-item">
<a href="#texting" class="nav-link">Texting</a>
</li>
<li class="nav-item">
<a href="#eventkonzeption" class="nav-link">Event Konzeption</a>
</li>
<li class="nav-item">
<a href="#impression" class="nav-link">Impressionen</a>
</li>
<li class="nav-item">
<a href="#ueber" class="nav-link">Über mich</a>
</li>
<li class="nav-item">
<a href="#kontakt" class="nav-link">Kontakt</a>
</li>
</ul>
<!-- navbar-nav -->
</div>
<!-- navbar-collapse -->
</div>
<!-- container -->
</nav>
<!-- Ende Navigation -->
</header>

<!-- Header -->
<section id="home" class="hero-bg jumbotron bg-info pb-0" style="height: 100vh;">
<div class="container d-flex flex-column h-100 pt-0 pb-4 header-h">
<hr style="background: white; height: 1px; width: 100%; border: 0">
<div class="align-items-start row justify-content-center mx-auto">

<div class="img-logo col align-self-start">
<img class="img-fluid d-block img-responsive" src="https://placehold.it/500x100" alt="Rollywood-Logo" >
</div>
<!-- col -->
</div>

<!-- row -->
<hr class="mt-auto mb-0" style="background: white; height: 1px; width: 100%; border: 0">

</div>

<!-- container -->
</section>
<!-- Header -->

注意:我还添加了 mx-auto到 Logo 图像 div 以使其水平居中。

关于html - 最后在超大屏幕中的 hr 行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48981800/

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