Can someone guide me on how to center an element ?
I know how to center it using align-items: center;
But the case here is that its a fixed div.
I also need the parent element not to be more longer than what is needed, that is, it shouldnt be longer than the length of the child elements in it(in this case, buttons).
Im not sure how to do this but this is what I tried to do.
Are there any clashes or overrides?
CSS →
.topbar{
position: fixed;
background-color: rgb(221, 228, 186);
font-size: 0;
margin-bottom: 20px;
align-items: center;
}
HTML part →
<div class="topbar">
<div class="row">
<a href="#about">
<button class="btn btn-default">About</button></a>
<a href="#early-life">
<button class="btn btn-default">Early Life</button></a>
</div>
</div>
Can send link to the repl if needed as the original code is big and kinda messy.