css workshop

Charles Johnsonfollow me on twitter
Tue Feb 27, 2001 at 10:08 am PST • Views: 176

the atmosphere continues to leak over LA. but this just in, from the Looking On The Bright Side Dept.: when the rain finally stops, at least we’ll get a few days of crystal clear air.

speaking of clearing the air, it’s amazing how much crud can accumulate in one’s CSS file. i went through the stylesheet for this page this morning weeding out unused classes, assigning classes to tags (e.g., the ‘greyheader’ and ‘date’ classes were combined into H1), and removing other detritus.

i’m trying to get closer to the ideal of separating structure from presentation by using header tags, paragraphs, etc. for structure and moving as many of the presentation elements as possible into the stylesheet. where they belong.

i moved the table cell backgrounds into the CSS as well; instead of using

<td background=”bg.gif”>

i define classes for the TD tag in the stylesheet, like this:

td.hdots {
  background-image: url(/shared-images/horizontaldots.gif);
}

then, to apply the background image, i can just assign a class to the TD tag like this:

<td class=”hdots”>

nice and clean!

from a purely philosophical viewpoint i shouldn’t be using tables at all for the design because the page doesn’t consist of “tabular” data. i probably could put together a layout that would look pretty much the same with DIVs, the true 21st century approach to web site design.

but from a purely pragmatic viewpoint (which usually takes precedence, kind of like a FONT tag in the code takes precedence over a CSS style), using tables lets this site look very nearly the same even in v4+ browsers that don’t understand CSS, or that have buggy implementations of CSS (can you say Netscape?). and it completely eliminates the need for clumsy browser-based redirection kludges.

now, if you’re looking at this with a version 3 or earlier browser, or if you have stylesheets turned off, it probably looks a bit strange because all the table cell backgrounds are in the CSS. you’re seeing gaps in the design where the backgrounds are supposed to be. but hopefully, it should still be readable…and the tables should keep the content in pretty much the same orientation. i think this is a decent tradeoff; keep the content readable and not too jumbled up, even if all the pretty graphics aren’t visible.

Advertisement

no comments

^ back to top ^

Name:

Pass:

Register Forgot Your Password? Re-send Confirmation (To log in, cookies must be enabled in your browser!)

Turn off ads by subscribing!
For about 33 cents a day, our subscription option turns off all advertisements at LGF!
Read more...


► LGF Headlines

  • Loading...

► Tweeted Articles

  • Loading...

► Tweeted Pages

  • Loading...

► Top 10 Comments

  • Loading...

► Bottom Comments

  • Loading...

► Recent Comments

  • Loading...

► Tools/Info

► Tag Cloud

► Contact

You must have Javascript enabled to use the contact form.
Your email:

Subject:

Message:


Messages may be published in our weblog, unless you request otherwise.
Tech Note:
Using the Contact Form

More Partners

Compare Electricity Prices in your area. Texas Electricity is deregulated; you have the right to choose Texas Electric Rates from among many Texas Electric Companies.

Notoriously dilettantish.

TwitterFacebook
LGF Pages
Recent Pages

Daniel Ballard
Prove Mitt's Not a Unicorn-Apologies To The Unicorns
1 hour, 6 minutes ago
Views: 29 • Comments: 0
Tweets: 0 • Rating: 0

researchok
Out of Gas
1 hour, 50 minutes ago
Views: 59 • Comments: 0
Tweets: 0 • Rating: 0

I AM BREITBART!
Seattle Manhunt Launched After Deadly Cafe Shootings, Carjacking
2 hours, 6 minutes ago
Views: 60 • Comments: 1
Tweets: 0 • Rating: 1

Shiplord Kirel
Dragon to Depart Station Thursday
3 hours, 17 minutes ago
Views: 32 • Comments: 0
Tweets: 0 • Rating: 1

Randall Gross
Citadel Malware Delivers Reveton Ransomware in attempts to extort money
4 hours, 10 minutes ago
Views: 103 • Comments: 0
Tweets: 0 • Rating: 2

Channeling Confucius
From the previous Diamond Jubilee: Kipling's 'Recessional'
4 hours, 41 minutes ago
Views: 67 • Comments: 0
Tweets: 0 • Rating: 0

Bob Dillon
REVEALED: Hundreds of Words to Avoid Using Online if You Don't Want the Government Spying on You
5 hours, 46 minutes ago
Views: 131 • Comments: 1
Tweets: 0 • Rating: 2

Learned Mother of Zion
Native Americans Have Jewish DNA!
6 hours, 5 minutes ago
Views: 246 • Comments: 9
Tweets: 1 • Rating: 6

Eclectic Infidel
Mitt Romney for a better Amercia!
6 hours, 10 minutes ago
Views: 130 • Comments: 1
Tweets: 0 • Rating: 0

Aigle
Ha'aretz, Lost in Translation
9 hours, 25 minutes ago
Views: 174 • Comments: 3
Tweets: 0 • Rating: 0

 Frank says:

The manner in which Americans "consume" music has a lot to do with leaving it on their coffee tables, or using it as wallpaper for their lifestyles, like the score of a movie -- it's consumed that way without any regard for how and why it was made. -- From "The Real Frank Zappa Book" (ch. 11)