Why do browsers reject the <img align=""> attribute?

llee

Golden Member
Oct 27, 2009
1,152
0
76
Does anyone know why you can no longer use the align attribute to modify an image's location on a web page? I know that you're supposed to put it in the <div> tag but it seems a little odd unless you plan on using CSS to manage hundreds of pictures.
 

Cogman

Lifer
Sep 19, 2000
10,284
138
106
The fact is that you ARE supposed to use CSS to manage a bunch of pictures. Since align has to do with the layout, it is slowly being depreciated in most browser. You don't have to enclose the image in a div, you just have to use a CSS style to define the layout of the pictures.
 

Aluvus

Platinum Member
Apr 27, 2006
2,913
1
0
Because the W3C deprecated it. Which they did because, as something that only affects presentation, it belongs in CSS rather than HTML. It has been deprecated for 11 years now; stop using it.

You can apply CSS styles directly to images (or any other HTML element) without wrapping them in a div. You can even do it inline if you really want that old-school feel.
 

PhatoseAlpha

Platinum Member
Apr 10, 2005
2,131
21
81
Plus, it keeps you from doing something insane, like:

Code:
<img src='IHateYouIE.jpg' ALIGN="LEFT" STYLE="text-align: left;">
 

911paramedic

Diamond Member
Jan 7, 2002
9,448
1
76
Plus, it keeps you from doing something insane, like:

Code:
<img src='IHateYouIE.jpg' ALIGN="LEFT" STYLE="text-align: left;">


That's the older style of writing html too, all caps. :thumbsdown:

I loved your comment Aluvus, " It has been deprecated for 11 years now; stop using it." :p
 

KIAman

Diamond Member
Mar 7, 2001
3,342
23
81
Welcome to CSS. Trust me, it's a pain in the ass to get started if you haven't been exposed but you will learn to love separating presentation from content.

Imagine this scenario. You have hundreds of images all left aligned. A change request comes down the pipe and now you need them right aligned. Instead of changing every <img> tag, you can simply change the single CSS.

That's a simple example but you can do some lovely things such as dynamically changing the ENTIRE layout of your website by simply changing the CSS.

Learn... to... love it!