Answer the question
In order to leave comments, you need to log in
How to move a block with text to another line in flex?
The intro block contains the video block, which contains the video background, and the logo block, which contains the logo. To place the logo clearly in the middle, I positioned it using flex, but I just can’t figure out how to make the make up inscription move to the next line and also be in the middle?
<div class="intro">
<div class="video">
<video src="video.mp4" class="video_media" autoplay muted loop></video>
</div>
<div class="logo">
<h1>KATYA LEER</h1>
<span>makeup</span>
</div>
</div>
.intro {
position: relative;
max-height: 100vh;
overflow: hidden;
background: url(../img/video-bg.jpg) top no-repeat;
background-size: cover;
}
.intro:after {
content: '';
top: 0;
left: 0;
right: 0;
bottom: 0;
position: absolute;
width: 100%;
height: 100%;
background-color: rgba(0,0,0,0.7);
z-index: 2;
}
.video {
padding-top: 0 !important;
padding-bottom: 56.25%;
z-index: 1;
}
.video_media {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: auto;
}
.logo {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
display: flex;
justify-content: center;
align-items: center;
z-index: 4;
}
.logo h1 {
font-size: 48px;
font-weight: 300;
letter-spacing: 20px;
}
.logo span {
font-size: 18px;
letter-spacing: 10px;
}
Answer the question
In order to leave comments, you need to log in
.logo {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
z-index: 4;
text-align: center;
}
<div class="intro">
<div class="video">
<video src="video.mp4" class="video_media" autoplay muted loop></video>
</div>
<div class="logo">
<div>
<h1>KATYA LEER</h1>
<span>makeup</span>
</div>
</div>
</div>
.logo {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
display: flex;
justify-content: center;
align-items: center;
z-index: 4;
text-align: center;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question