css workshop

• Views: 3,764

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

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:

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.

Jump to top

Create a PageThis is the LGF Pages posting bookmarklet. To use it, drag this button to your browser's bookmark bar, and title it 'LGF Pages' (or whatever you like). Then browse to a site you want to post, select some text on the page to use for a quote, click the bookmarklet, and the Pages posting window will appear with the title, text, and any embedded video or audio files already filled in, ready to go.
Or... you can just click this button to open the Pages posting window right away.
Last updated: 2023-04-04 11:11 am PDT
LGF User's Guide RSS Feeds

Help support Little Green Footballs!

Subscribe now for ad-free access!Register and sign in to a free LGF account before subscribing, and your ad-free access will be automatically enabled.

Donate with
PayPal
Cash.app
Recent PagesClick to refresh
Once Praised, the Settlement to Help Sickened BP Oil Spill Workers Leaves Most With Nearly Nothing When a deadly explosion destroyed BP’s Deepwater Horizon drilling rig in the Gulf of Mexico, 134 million gallons of crude erupted into the sea over the next three months — and tens of thousands of ordinary people were hired ...
Cheechako
Yesterday
Views: 56 • Comments: 0 • Rating: 0
Texas County at Center of Border Fight Is Overwhelmed by Migrant Deaths EAGLE PASS, Tex. - The undertaker lighted a cigarette and held it between his latex-gloved fingers as he stood over the bloated body bag lying in the bed of his battered pickup truck. The woman had been fished out ...
Cheechako
4 days ago
Views: 162 • Comments: 0 • Rating: 1