Ask coding questions

← Back to all posts
How can I center my <H1> elements
TriciaKennedy (8)

Trying to center h1 element tag

timmy_i_chen (1188)

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

roboticmind (1)
<center></center> should also work depending on how you have it set up
TriciaKennedy (8)

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

Yamboy1 (38)

@TriciaKennedy You could use the following css

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

Heres an example repl: