• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

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

llee

Golden Member
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.
 
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.
 
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.
 
Plus, it keeps you from doing something insane, like:

Code:
<img src='IHateYouIE.jpg' ALIGN="LEFT" STYLE="text-align: left;">
 
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." 😛
 
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!
 
Back
Top