<section>
<div class="wrapper--title one">
<h1>
text
</h1>
</div>
<div class="wrapper--title two">
<h1>
text
</h1>
</div>
</section>
* {
margin: 0;
padding: 0;
}
body {
font-size: 16px;
background-color: rgba(0, 0, 0, .6);
color: #fff;
}
section {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
width: 100%;
height: 100vh;
}
.wrapper--title {
height: 300px;
width: 100%;
margin: 0 auto;
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
h1 {
font-size: 30px;
position: relative;
z-index: 3;
display: inline-block;
}
.wrapper--title::after {
content: "";
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: 2;
background-color: rgba(0, 0, 0, .6);
}
.wrapper--title::before {
font-size: 100px;
padding: 10px;
background-color: #fff;
color: rgba(0, 0, 0, .6);
position: absolute;
top: 50%;
left: 50%;
z-index: 1;
transform: translate(-50%, -50%);
}
.one::before {
content: "one";
}
.two::before {
content: "two";
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.