W3C home > Mailing lists > Public > public-html@w3.org > July 2007

Re: the style attribute

From: Maurice Carey <maurice@thymeonline.com>
Date: Mon, 16 Jul 2007 13:54:10 -0400
To: HTML Working Group <public-html@w3.org>
Message-ID: <C2C12902.348B%maurice@thymeonline.com>


Sorry I havenıt had a chance to locate the original topic and I donıt even
know if this is still an issue since Iım soooo behind in reading the
messages (244 unread:( ).

One important reason I have for keeping the style=²² attribute on all tags
is that Iıve done a lot of sites recently where the client wants a very
inflexible layout but wants the ability to put any sized photo in the main
photo area. So weıve got this area of 500x300px and any sized image needs to
go in there and look sensible. The images could be landscaped or portrait.
To make the photos look as nice as we could given the layout we decided that
all images in the main area and in the thumbnails will be absolutely
positioned to be in the center of the area. Say for instance the client uses
a very tall photo of a beach, instead of getting just the sky at the top or
just the sand at the bottom, by absolutely positioning it we get the horizon
line, sun, clouds, boats etc... as the focal point.

To do this we get the dimensions of the photo on the server side, do some
math in relation to the size of the area where the photo is displayed and
come up with top & left values that get put into a style attribute on the
<img> tag.

Some people have suggested style on tags is only used when people are lazy
or in a rush. The choice to use style as the solution was neither rushed or
lazy.

:::
Yes I know I could have achieved this by doing the same thing server side
with javascript but we wanted the photos to be positioned nicely in their
boxes whether the user had javascript enabled or not.
:::





-- 
::   thyme online ltd
::   po box cb13650  nassau  the bahamas
::   website: http://www.thymeonline.com/
::   tel: 242 327-1864  fax: 242 377 1038
Received on Monday, 16 July 2007 17:54:12 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 9 May 2012 00:16:02 GMT