css workshop

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

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? Account Settings 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

► LGF Hits

► Resources

► Never Forget

► Statistics

► 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.

Knowing the enemy can be a real pain in the ass.

TwitterFacebook
LGF Pages
Recent Pages

Conservative Moonbat
Anti-Islamic Group Trains Tennessee Deputies
43 minutes ago
Views: 14 • Comments: 3
Tweets: 0 • Rating: 1

No. Just, no.
The least romantic city in the US
4 hours, 22 minutes ago
Views: 73 • Comments: 1
Tweets: 0 • Rating: 0

No. Just, no.
Psycho jerk was psycho
4 hours, 42 minutes ago
Views: 70 • Comments: 1
Tweets: 0 • Rating: 0

researchok
Forrest GOP
6 hours, 37 minutes ago
Views: 87 • Comments: 0
Tweets: 2 • Rating: 1

researchok
Obama Plan Will End Dozens of Business Tax Breaks
7 hours, 45 minutes ago
Views: 104 • Comments: 0
Tweets: 1 • Rating: 1

Randall Gross
NBCU Taps Google to Create Cross-Platform Audience Metric for 2012 Olympics
8 hours, 32 minutes ago
Views: 84 • Comments: 0
Tweets: 0 • Rating: 2

Randall Gross
Exclusive: Church Probes How Priest Was Ordained After Abuse Sacking - Main Section - Yorkshire Post
8 hours, 35 minutes ago
Views: 104 • Comments: 0
Tweets: 0 • Rating: 2

Randall Gross
Santorum's Stone-Age View of Women
8 hours, 37 minutes ago
Views: 158 • Comments: 0
Tweets: 1 • Rating: 2

Channeling Confucius
The Dogs Against Romney Facebook group tries to put on an IRL protest against the Republican outside the Westminster Kennel Club
8 hours, 46 minutes ago
Views: 94 • Comments: 0
Tweets: 0 • Rating: 0

Bob Dillon
Hidden Communal Guns Are More Common
9 hours, 10 minutes ago
Views: 131 • Comments: 2
Tweets: 0 • Rating: 3

 Frank says:

Weedley-Weedley-Wee -- Specifically, the small fret guitar-playing technique that musicians have a tendency to display while in pursuit of a cross between a waitress and a hoover vacuum... This, of course, from his book.