Skip to content
← Back to Community
How do I center an image?
Profile icon
kenzielixir

The title says it all. I can't figure out how to center the coin image.

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
MariaSiquinaCot
Profile icon
eliasbarba
Profile icon
OluwafunbiModup
Profile icon
kenzielixir
Comments
hotnewtop
Profile icon
Coder100

Put it inside a div:

<div style="text-align: center;"><img></div>
Profile icon
kenzielixir

In CSS? @Coder100

Profile icon
Coder100

no, this is html @kenzielixir

Profile icon
Coder100

oh lol here, in your case it looks like:

<div> <img id = "tails" src ="img/tails.png" alt="tails" height="220px" width="240px" onclick="flipCoin1()"/> </div>

@kenzielixir

Profile icon
kenzielixir

Ohhh okay. Thanks! @Coder100

Profile icon
Coder100
Profile icon
RYANTADIPARTHI

You can use some inline CSS

<img src="SOMETHING" style="text-align: center"> <!-- OR THIS --> <img src="SOMETHING" style="margin-left: 10px;"

That should work.

Profile icon
kenzielixir

Thanks @RYANTADIPARTHI! I can't mark this as the correct answer bc I already @Coder100's answer as the correct one. But ty!

Profile icon
RYANTADIPARTHI

@kenzielixir np. But you can upvote my answer. :)

Profile icon
kenzielixir

OH wait a second
@RYANTADIPARTHI

Profile icon
kenzielixir

I think I can mark it as a best answer
@RYANTADIPARTHI

Profile icon
kenzielixir

It says I can mark it but it won't work..

Profile icon
RYANTADIPARTHI

@kenzielixir no, i meant like beside my comments, there's some number. Just click that. :)

Profile icon
kenzielixir

Oh lol. OKay @RYANTADIPARTHI

Profile icon
RYANTADIPARTHI

@kenzielixir yeah np. Thanks!

Profile icon
realTronsi

@RYANTADIPARTHI please stop cycle farming