所以我想将标语与超大屏幕垂直和水平对齐,顶部 Logo 位于正确的位置,小同种型应一直位于超大屏幕的底部。
非常感谢任何帮助。
#hero {
height: 50vh;
background-image: url("/img/background.png");
background-size: cover;
background-repeat: no-repeat;
padding-top: 0.5em;
padding-bottom: 0.5em;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4"
crossorigin="anonymous">
<link rel="stylesheet" href="/css/custom.css">
<title>Document</title>
</head>
<body>
<div class="jumbotron jumbotron-fluid" id="hero">
<div class="container">
<div class="row">
<div class="col-12 text-left align-top h-25">
<img src="/img/toplogo.png" alt="">
</div>
<div class="col-12 text-center align-middle h-auto">
<img src="img/slogan.png" alt="">
</div>
<div class="col-12 text-right align-bottom test">
<img src="/img/logowhite.png" alt="">
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js" integrity="sha384-cs/chFZiN24E4KMATLdqdvsezGxaGsi4hLGOzlXwp5UZB1LY//20VyM2taTB4QvJ"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js" integrity="sha384-uefMccjFJAIv6A+rW+L4AHf99KvxDjWSu1z9VI8SKNVmz4sk7buKt/6v9KI65qnm"
crossorigin="anonymous"></script>
</body>
</html>
最佳答案
如果我是对的,您要求将标语垂直对齐到中心并将同种型对齐到底部,如上图所示。您可以将以下内联样式部分添加到标语和小同型中。
将口号与中间对齐:
<img src="img/slogan.png" alt="" style="top:--height from the top-- ;">
或
<img src="img/slogan.png" alt="" style="display: flex; flex-direction: column; justify-content: center;">
将小同种型设置到底部:
<img src="/img/logowhite.png" alt="" style="top:--height from the top-- ;">
或
<img src="img/logowhite.png" alt="" style="display: flex; flex-direction: column; justify-content: center;">
我想,这对你有用。
关于html - 如何强制行及其列使用其父元素 (jumbotron) 高度的 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50115217/