<!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="flexHero.css">
<title>Sliding Hero Image using Flexbox</title>
</head>
<body>
<div class="hero-image">
<div class="hero-text">
<h1 class="hero-header">bloom</h1>
<p>inner and outer self-care</p>
</div>
</div>
</body>
</html>
body, html {
height: 100%;
margin: 0;
font-family: Arial;
}
.hero-image {
display: flex;
flex-direction: column;
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("https://images.pexels.com/photos/2234006/pexels-photo-2234006.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 15em;
height: 50%;
align-self: center;
background-repeat: no-repeat;
background-size: cover;
background-attachment: fixed;
align-items: center;
justify-content: center;
}
.hero-text {
text-align: center;
color: white;
}
.hero-header{
align-self: center;
font-size:50px;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.