Align='center' with <img> tag | Sololearn: Learn to code for FREE!

+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

8/29/2019 6:43:06 AM

Trigger

4 Answers

New Answer

+1

Align attribute is deprecated, please style the alignment from css. https://www.w3.org/TR/html401/present/graphics.html

+1

And are you sure that the IMG tag was not wrapped within any p tag or div or any block level element???

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

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