Skip to content
← Back to Community
How can I center my <H1> elements
Profile icon
TriciaKennedy

Trying to center h1 element tag

Voters
Profile icon
MinjinKim
Profile icon
azharuln
Profile icon
JerusalenZarate
Profile icon
woo0002
Profile icon
ZynalRustam
Profile icon
DanielRodrigu22
Profile icon
Logimite
Profile icon
timmy_i_chen
Comments
hotnewtop
Profile icon
timmy_i_chen

Have you looked into using text-align: center; in your CSS yet?

Profile icon
roboticmind
should also work depending on how you have it set up
Profile icon
TriciaKennedy

ok I got it centered but I am trying to center a img [email protected]

Profile icon
Yamboy1

@TriciaKennedy You could use the following css

img { margin-left: auto; margin-right: auto; display: block; }

Heres an example repl: https://repl.it/@Yamboy1/WellmadeOnerlookedSites

Profile icon
TriciaKennedy