Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Ignoring a Stylesheet

Reply
Thread Tools

Ignoring a Stylesheet

 
 
Lee Marsh
Guest
Posts: n/a
 
      05-30-2005
Quick question...if in the header of the page I have this:

<style>
img{
height:110px;
width:130px;
}
</style>


how can I make a single image on the page ignore this rule and define its
height and width uniquely, and continue to allow that style to dictate every
other image on the page? TIA


--
<=============>
--Lee
http://www.inaneasylum.org


Goodbye, adios, bis bald, see ya later, wiedersehen, and everything in
between


 
Reply With Quote
 
 
 
 
Mark Parnell
Guest
Posts: n/a
 
      05-30-2005
Previously in alt.html, Lee Marsh <> said:

> how can I make a single image on the page ignore this rule and define its
> height and width uniquely, and continue to allow that style to dictate every
> other image on the page? TIA


<img class="somethingDescriptive" ... >

img.somethingDescriptive { height: auto; width: auto; }

--
Mark Parnell
http://www.clarkecomputers.com.au
alt.html FAQ :: http://html-faq.com/
 
Reply With Quote
 
 
 
 
Chris Hope
Guest
Posts: n/a
 
      05-30-2005
Lee Marsh wrote:

> Quick question...if in the header of the page I have this:
>
> <style>
> img{
> height:110px;
> width:130px;
> }
> </style>
>
>
> how can I make a single image on the page ignore this rule and define
> its height and width uniquely, and continue to allow that style to
> dictate every other image on the page? TIA


<img style="width:auto; height:auto" ...

OR

<img style="width:XXXpx; height:YYYpx" ...

where XXX and YYY are the width and height.

You can also declare these as a style class or with an id in the
stylesheet instaad of inline eg

<style>

#foo {
width: XXXpx;
height: YYYpx;
}

</style>

<img id="foo" ...

--
Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com
 
Reply With Quote
 
Spartanicus
Guest
Posts: n/a
 
      05-30-2005
"Lee Marsh" <> wrote:

><style>
>img{
> height:110px;
> width:130px;
> }
></style>


Image dimensions should be specified via html attributes, not via an
optional component such as CSS.

Often also applies to other seemingly presentational data like valign on
a data table. Your markup should work without CSS.

--
Spartanicus
 
Reply With Quote
 
Lee Marsh
Guest
Posts: n/a
 
      05-31-2005




>
> Image dimensions should be specified via html attributes, not via an
> optional component such as CSS.

Well, in this case the spreadsheet would fail 'gracefully' but yes, I see
what you mean.


> Often also applies to other seemingly presentational data like valign on
> a data table. Your markup should work without CSS.

I'm kind of new with using CSS for anything more than managing fonts and
color schemes, so this raises a question in my mind: is the same true of CSS
and page layout? Because it seems like everyone agrees that CSS is ideal for
page layout, so does that not fall under the classification of
'presentational data', or are you supposed to still have another means to
display a page if a visitor doesnt support CSS?
--
<=============>
--Lee
http://www.inaneasylum.org
Goodbye, adios, bis bald, see ya later, wiedersehen, and everything in
between


 
Reply With Quote
 
Spartanicus
Guest
Posts: n/a
 
      05-31-2005
"Lee Marsh" <> wrote:

>> Image dimensions should be specified via html attributes, not via an
>> optional component such as CSS.


>Well, in this case the spreadsheet would fail 'gracefully' but yes, I see
>what you mean.


The function provided by supplying image dimensions to a browser before
the images have been downloaded has no fall back, there is no graceful
fail.

Providing image dimensions beforehand allows a browser to layout a page
before the actual images have been downloaded. Without knowing the image
dimensions a browser would have to reflow the layout as the dimensions
of each image becomes clear after each single image has downloaded.

>> Often also applies to other seemingly presentational data like valign on
>> a data table. Your markup should work without CSS.


>I'm kind of new with using CSS for anything more than managing fonts and
>color schemes, so this raises a question in my mind: is the same true of CSS
>and page layout? Because it seems like everyone agrees that CSS is ideal for
>page layout, so does that not fall under the classification of
>'presentational data', or are you supposed to still have another means to
>display a page if a visitor doesnt support CSS?


Layout should be presentational, if it's provided via css and the css
isn't used for some reason then nothing essential should be lost.

As a quality check authors should switch off images, css, client side
scripting, java, plugins and other optional technologies, a page or site
should remain fully functional.

--
Spartanicus
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      06-06-2005
Spartanicus wrote:
<snip>
>
> Layout should be presentational, if it's provided via css and the css
> isn't used for some reason then nothing essential should be lost.
>
> As a quality check authors should switch off images, css, client side
> scripting, java, plugins and other optional technologies, a page or site
> should remain fully functional.
>


A place where CSS specified img dims can be useful is with a gallery of
thumbnails so the layout doesn't reflow as the thumbs load.

1. resample images to actual display size, like 50x50 px for thumbs with
image editor

2. make a class for the specified images not to general image tag IMG

3. then code your spec'd image with that class...


<img class="thumbs" src="someImage.jpg" title="thumbnail of some image"> ...
<img class="thumbs" src="someOtherImage.jpg" title="thumbnail of some
other image">
....

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
Spartanicus
Guest
Posts: n/a
 
      06-06-2005
"Jonathan N. Little" <> wrote:

>> Layout should be presentational, if it's provided via css and the css
>> isn't used for some reason then nothing essential should be lost.
>>
>> As a quality check authors should switch off images, css, client side
>> scripting, java, plugins and other optional technologies, a page or site
>> should remain fully functional.

>
>A place where CSS specified img dims can be useful is with a gallery of
>thumbnails so the layout doesn't reflow as the thumbs load.


As I wrote before, that's why you *should not* use CSS for this, but you
snipped it, so here it is again:

---
Image dimensions should be specified via html attributes, not via an
optional component such as CSS.

The function provided by supplying image dimensions to a browser before
the images have been downloaded has no fall back, there is no graceful
fail.

Providing image dimensions beforehand allows a browser to layout a page
before the actual images have been downloaded. Without knowing the image
dimensions a browser would have to reflow the layout as the dimensions
of each image becomes clear after each single image has downloaded.
---

If the client has css disabled or the css file isn't used for some other
reason (network or server problem for example) then the client has to
reflow whilst the images download. Image dimensions should be supplied
in the markup.

--
Spartanicus
 
Reply With Quote
 
Jonathan N. Little
Guest
Posts: n/a
 
      06-07-2005
Spartanicus wrote:
> "Jonathan N. Little" <> wrote:
>
>
>>>Layout should be presentational, if it's provided via css and the css
>>>isn't used for some reason then nothing essential should be lost.
>>>
>>>As a quality check authors should switch off images, css, client side
>>>scripting, java, plugins and other optional technologies, a page or site
>>>should remain fully functional.

>>
>>A place where CSS specified img dims can be useful is with a gallery of
>>thumbnails so the layout doesn't reflow as the thumbs load.

>
>
> As I wrote before, that's why you *should not* use CSS for this, but you
> snipped it, so here it is again:
>
> ---
> Image dimensions should be specified via html attributes, not via an
> optional component such as CSS.
>
> The function provided by supplying image dimensions to a browser before
> the images have been downloaded has no fall back, there is no graceful
> fail.
>
> Providing image dimensions beforehand allows a browser to layout a page
> before the actual images have been downloaded. Without knowing the image
> dimensions a browser would have to reflow the layout as the dimensions
> of each image becomes clear after each single image has downloaded.
> ---
>
> If the client has css disabled or the css file isn't used for some other
> reason (network or server problem for example) then the client has to
> reflow whilst the images download. Image dimensions should be supplied
> in the markup.
>

I agree that putting the dims in the markup is best, but one could argue
that the IMG SRC property determines the 'content' and therefore HTML
domain, and the WIDTH and HEIGHT effect the 'style' or 'presentation' of
the page and is a CSS issue...

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ReportViewer Control Ignoring Stylesheet in ASP.NET Web Page John R. Millwood ASP .Net Web Controls 0 11-13-2008 06:48 PM
Firefox and XSLT (local stylesheet works, server-based stylesheet fails) David Blickstein XML 14 10-15-2005 11:27 PM
xml:stylesheet use in document with multiple stylesheet options David Blickstein XML 3 08-02-2005 03:10 PM
have a stylesheet generate another stylesheet based on XML? Steven An XML 1 11-23-2004 01:07 PM
Stylesheet referanse i stylesheet =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?= XML 3 07-04-2004 03:16 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57