Align problem | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Align problem

div{ text-align : center } But why don't img center ? 🤔🤔🤔🤔🤔 https://code.sololearn.com/W3Q5ac53OCPM/?ref=app

20th Mar 2022, 9:28 AM
Shai Shab
Shai Shab - avatar
9 Answers
20th Mar 2022, 10:49 AM
A͢J
A͢J - avatar
+ 2
Shaishab Chandra Shil You cannot align img directly because align is not an attribute of img tag so you need to put img inside a div or span then you can put img in center. body #profile { text-align: center; } <body> <div id = "profile"> <img src = "" /> </div> </body>
20th Mar 2022, 10:01 AM
A͢J
A͢J - avatar
+ 1
Use This In CSS Instead: input{ text-align: center; } Just Replace The Div With The Input Hope This Helps 🤗
20th Mar 2022, 9:37 AM
Sancho Godinho
Sancho Godinho - avatar
+ 1
But, Your Image Is Already Centered! Proof: https://i.ibb.co/mcdc6w4/Temp.png
20th Mar 2022, 9:45 AM
Sancho Godinho
Sancho Godinho - avatar
+ 1
Img is centered well
20th Mar 2022, 11:53 AM
Shadoff
Shadoff - avatar
+ 1
Shaishab Chandra Shil I didn't use center tag. Check again.
20th Mar 2022, 4:36 PM
A͢J
A͢J - avatar
0
Sancho Godinho but img don't be centered ??
20th Mar 2022, 9:39 AM
Shai Shab
Shai Shab - avatar
0
A͢J I try but not work
20th Mar 2022, 10:35 AM
Shai Shab
Shai Shab - avatar
0
A͢J it's work but you replace center @ div . Then see magic
20th Mar 2022, 2:15 PM
Shai Shab
Shai Shab - avatar