rough sketch of what I wantI have a label that I want to center in the page and I have a parent set to 100% width and the actual element set to a block display and the margin set to auto. If I set the element's width to a small value then it does actually center it, however the element stays static as I resize the window when I want it to adapt to the window size. The element I want to center is under the class "label_"
.container {
display: block;
width: 100%;
}
.label_ {
border: 1px solid red;
display: block;
color: white;
z-index: 11;
margin: 0 auto;
font-family: "Handlee";
font-size: 50px;
}
<form>
<div class="container">
<label class="label_" for="username">Username</label>
<input id="username" type="text" placeholder="Username">
</div>
</form>
<div class="background">
<img src="background.png" alt="">
</div>
<div class="logo">
<img id="amongus" src="amongus.png" alt="">
</div>
<div class="red">
<img id="red" src="an871k4o1sn51.png" alt="">
</div>