When centering things in html and css, I find two approaches - either applying on the element :
display:block;
margin:0 auto;
or using:
Block elements should always be centered using
.block {
margin-left: auto;
margin-right: auto;
width: 600px;
}
as stated by the w3c: http://www.w3.org/Style/Examples/007/center.en.html#block
text-align: center;
is well-named: use it to center texts.
You can also use display: flex
now:
.parent {
display: flex;
justify-content: center;
}
.block {
width: 200px;
}