+ 1

How can I make bordered text elements to be in the middle of the page?

I'm confused on how to do this seemingly easy task. I mean to horizontally align the entire element to the center. The h1 here is what I'm trying to work on https://code.sololearn.com/WTjDpTAZADH8/?ref=app

16th Aug 2022, 5:38 PM
DarkPhoenix15
DarkPhoenix15 - avatar
2 Respostas
+ 3
Add margin: 0 auto; To your h1 element, this trick work for block level elements such as h1, it set equal margin on left and right, and this will push element to center.
16th Aug 2022, 5:55 PM
PanicS
PanicS - avatar
+ 2
Also here are more methods for centering: https://www.w3schools.com/css/css_align.asp I mostly use margin or make container display: flex and than center with justify-content: center. If you need to center img for example what are inline element you need to convert it to block with display: block, than you can use margin trick.
16th Aug 2022, 6:22 PM
PanicS
PanicS - avatar