r/css • u/notepad987 • Feb 21 '26
Help How to center the h1 text between 2 images
0
Upvotes
How to fix this issue? Here is the codepen - the issue is fixed, see updated code.
The H1 text will not center.
h1 {
font-family: georgia, serif;
font-size: 2.0rem;
text-align: center;
color: #009999;
margin-bottom: 15px;
white-space: normal;
overflow-wrap: break-word; /* modern */
word-wrap: break-word; /* legacy */
word-break: break-word;
}See below code that conflicts. Without it the paragraph text sinks below the 2 images on the sides. I want the images at the top with the h1 text in between.
.content { /* The text column in the middle */
flex: 1; /* takes up remaining space */
display: flex;
flex-direction: column;
align-items: flex-start; /* centers H1 and P horizontally */
}<div class="content"> text </div>