Sent by Philippe Wittenbergh on 30 September 2002 02:02
On Monday, September 30, 2002, at 08:42 AM, Hassan Schroeder wrote:
> Adam Wodon wrote:
>
>>> I believe that it can handle some inline styles and not others...
>
> I've never seen this, and I still do a lot of work for a client
> with an all-NS4 intranet, but ...
>
>> So, if I float an image in a news article, I must set a width. Problem
>> is, these are PHP templates. One template fits all. There's no way
>> the
>> style sheet will know what the width of the image is before it's
>> called.
>> I've been setting everything but the width in the CSS, then setting the
>> width inline.
>> Any alternatives?
>
> Use PHP's image-resizing function to make all the images the same
> width? Might be the easiest ...
Attach a class to the <img> tag itself, then you don't need to specify
width. I'd quote the specs, but can't seem to connect to the W3C site at
the moment.
css .myimg { float:left; more things if needed}
html <img src="myimg.gif" class="myimg" />
Or, use a descendent selector
css: div.myblock img { float:left; more things if needed}
html: <div class="myblock"> <p><img src="myimg.gif" />blablabla</p></div>
HTH
Philippe
== | == | == | == | == | == | == | == | == | == | == | ==
Philippe Wittenbergh
code | design | web projects : < http://www.l-c-n.com/>
online image gallery : <http://www.l-c-n.com/phiw/>