I am trying to make a page title header, in the middle of my webpage below my navigation bar, then I am trying to make the header border wrap close around the text of the header, so that there is not a lot of padding on the left and the right.
I am able to center the header, I am able to change the font, decoration, etc. of the header, but I cannot figure out why the width of the header cannot be manipulated without the header itself changing its position.
I have tried changing CSS code both in the parent div and the header child, but to no avail, nothing I try seems to work.
I have checked the console to see if some of the code I wrote didn't affect my elements, but the console showed that the code was affecting them.
Please show me where I'm making the mistake...
.title {
position: relative;
}
.title h1 {
display: flex;
justify-content: center;
position: static;
font-family: 'Prompt', sans-serif;
font-size: 40px;
color: white;
background-color: black;
border: 3px solid yellow;
border-radius: 10px;
}
<div class="title">
<h1>LOCATIONS</h1>
</div>
This is the code which centers the header, without messing up the position of the header on my page.