Table Elements, Background Images, and the
:hover Pseudo Class

Normally, the :hover pseudo class is applied to anchor (link) tags to indicate the hover state of the link, as in a:hover. Here is an example of how CSS styling can be used to create a menu from an unordered HTML list:

By attaching a different image to the two main link states (or as in this case, the same image only positioned differently) a kind of visual interactivity is created. This method uses CSS to style the content alone, but the technique can also be applied to layout structures as well. The key to using CSS in Freeway 4 Pro to style either content or structure is knowing what code tags identify the elements you’re looking for, whether they are parts of a list or parts of a table.

Table structure starts out fairly simple with the <table> tag to define the beginning of the table container. Then horizontal rows are defined with the <tr> tag, and individual cells with the <td> tag. In Freeway 4 Pro, you can target all these structures with Tag Styles — that is, styles that use the tag name of the item they are trying to define. Since that would target everything on the page with that tag, we will create an “empty” class style (just a name, no attributes) and apply it to a table by carefully selecting only the table then choosing the style name from the style pallette. This will single out that table (by class) so we can target it with tag styles specifically chosen for it.

Applying the :hover Pseudo Class to Table Elements

link

link

link

no link

By applying the empty class style .targetcell to this table, I can then create the style .targetcell td to style the backgrounds of the cell tags of that table. By adding the pseudo class :hover to make the style .targetcell td:hover with a different background is like saying this style applies “only to the table cells of this object when the mouse pointer is hovering over them.” Note that even the cell with no link in it triggers, as it is the cell itself that is sensing the hover event. Link text is still necessary, as the link tag <a> can only be applied to content (as far as I know) and table cells are not content, but structure for content.

link

link

link

no link

This table also has an empty class style to identify it, but instead of targeting the table cells, I target the row tags <tr> with the :hover pseudo class. This might be more practical (and acceptable from my point of view) for visually highlighting dense tabular data, as in the example below – which, I know, is not very dense. It was the only example I had that was handy.  

Songs I Listened to While Preparing this Article…

NAME

ARTIST

ALBUM

TIME

This Note's For You

Neil Young

Lucky Thirteen

334

Learning To Fly

Pink Floyd

A Momentary Lapse Of Reason

293

Vamos a Bailar

Gypsy Kings

Mosaique

309

Utopia

Alanis Morissette

Under Rug Swept

298

In My Time Of Dyin'

Bob Dylan

Bob Dylan

159

Samba

Baaba Maal

Baayo

343

London Part One (The Dungeon Cry)

Tangerine Dream

Book Of Dreams

431

Wrong To Love You

Chris Isaak

Heart Shaped World

259

Nativity Medley (four carols)

the Hepcats

 

316

La Nuit Des Jeux

Anouar Brahem

Barzakh

332

Juke Box Hero

Foreigner

Records

243

Fanfare for Rocky

Bill Conti

Rocky (sndtrk)

154

Hawkmoon 269

U2

Rattle And Hum

382

My Beautiful Reward

Bruce Springsteen

Lucky Town

235

She Said

Collective Soul

7even Year Itch (Greatest Hits 1994-2001)

255

Henry Kissinger

Monty Python

Monty Python Sings

91

Until I'm Dead and Cold

B.B. King

Indianola Mississippi Seeds

285

My Back Pages

Ramones

Acid Eaters

147

One White Duck

Jethro Tull

Minstrel in the Gallery

278

Iron Man

Black Sabbath

Paranoid

358

Roll Over Beethoven

Beatles (the)

With the Beatles

167

You're A Wonderful One

Marvin Gaye

Bowfinger (sndtrk)

169

Criminal

The Pretenders

The Isle Of View

258

Son Of A Preacher Man

Dusty Springfield

Pulp Fiction (sndtrk)

148

Foreplay Long Time

Boston

Boston

467

Ainda Lembro (w/ Ed Motta)

Marisa Monte

 

235

Nazareth Pilgrim Blues

JustaPicker

The Mudcat Café Blue Plate Special: Rose

176

Wonderful Tonight

Eric Clapton

Time Pieces - The Best Of Eric Clapton

219

Suspicious Minds (suspicious mix)

Fine Young Cannibals

Fine Young Cannibals

473

Walking With Frankie

Frankie Lee Sims

Genuine Mississippi Blues

212

Just A Gigolo / I Ain't Got Nobody

Louis Prima

Buona Sera

283

Every Sperm Is Sacred

Monty Python

Monty Python Sings

274

Chain of Fools

The Commitments

The Commitments (sndtrk)

178

What Will Lucy Mae Do

Frankie Lee Sims

Genuine Mississippi Blues

143

Light My Fire

The Doors

The Doors

428

They Call It Stormy Monday (But Tuesday Is Just As Bad)

John Hammond

Big City Blues

248

Before You Accuse Me

Creedence Clearwater Revival

Chronicle

207

Darlington County

Bruce Springsteen
& The E Street Band

Bruce Springsten Live 1975-85

310

Friend Of The Devil

Grateful Dead

American Beauty

204

Such A Woman

Neil Young

Harvest Moon

277

If I Had $1,000,000

Barenaked Ladies

All Their Greatest Hits 1991-2001

265

Potential Drawbacks to using the :hover Pseudo Class this way

The first, and possibly largest hurdle is browser compatibility. As of yet, I have not tested this technique in any Windows browsers. Should it not be supported by at least IE6, then this has been just an academic exercise. A second serious drawback is the effect doesn't seem to work on cells that have already been colored. Try this:

this works

and so does this

no way, josé!

But this is ok

In Conclusion

This technique may not be ready for wide use just yet, but certainly shows how CSS can be used to decorate both content and structure. For the more adventurous (or plainly curious) here is the Freeway 4 Pro 4.3.1 file to Download (29.15 K)