Why doesn't it work? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why doesn't it work?

Why does the "align" attribute work for most/all html elements, but not the "img" element?

19th Jun 2018, 3:41 AM
Dlite
Dlite - avatar
2 Answers
+ 1
It would be a good idea to post your code snippet for other learners to inspect your code. As far as I am concerned, the align attribute works well with img.
19th Jun 2018, 4:07 AM
Fermi
Fermi - avatar
+ 4
Because "img" is an inline element bro, not a block level element, and therefore positional attributes do not apply. You would have to put the img into a block level container (such as div) and align the block. Cheers.
19th Jun 2018, 4:07 AM
Tony
Tony - avatar