html - 如何强制行及其列使用​​其父元素 (jumbotron) 高度的 100%

标签 html css twitter-bootstrap bootstrap-4

This is what I have and what I want

所以我想将标语与超大屏幕垂直和水平对齐,顶部 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/

相关文章:

html - 我如何在这个表单旁边保留一个 h1 标签和一个 p 标签? ( Bootstrap )

html - CSS:如何将表单输入字段和按钮放在同一行中并排放置?

java - 您可以根据自己的需要创建一个 TestNG Listener

javascript - 使用 React 设置对象属性的样式

jquery - Bootstrap css 输入按钮插件对齐问题

html - 如何在 Bootstrap 中将图像添加到另一个图像的左上角?

html - 鼠标移开时的 CSS3 过渡

html - 如何设置div高度为100%?

CSS:固定背景图像比浏览器视口(viewport)高

c# - 我的数据 GridView 未在浏览器中显示