Align='center' with <img> tag | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Align='center' with <img> tag

Recently in a test (pure HTML, no HTML5), they asked us to keep the text from flowing around the image Image code was: <img src="beach.jpg" align="left" /> A friend removed the align attribute and it had the desired effect, I changed it to align="justify" and it worked (probably because it defaults to something) The memo wanted us to use align="center", but I thought that align="center" doesnt do anything with images. It also worked, but I think its the same reason as why my answer worked (defaults to something if the attribute was invalid) Can anyone explain more about this particular attribute, and how it works with images? No CSS is allowed in the exams

29th Aug 2019, 6:43 AM
Trigger
Trigger - avatar
4 Answers
+ 1
Align attribute is deprecated, please style the alignment from css. https://www.w3.org/TR/html401/present/graphics.html
29th Aug 2019, 7:07 AM
Calviղ
Calviղ - avatar
+ 1
And are you sure that the IMG tag was not wrapped within any p tag or div or any block level element???
29th Aug 2019, 7:13 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
Calviղ I know its deprecated, but our school doesnt use CSS or HTML in our exams (only html), which *does* annoy me but that's how it is🤷‍♂️ I would use css if I was allowed
29th Aug 2019, 7:32 AM
Trigger
Trigger - avatar
0
Sami Khan Nope. Wasnt encased in a block level element. Was below an h1 tag in the body section, to be specific. Nothing like what you said
29th Aug 2019, 7:34 AM
Trigger
Trigger - avatar