Forums | MacLife
You are not logged in.
#1 2008-10-02 1:31 am
- cosmicosmo
- Chancellor Mmmm

- From: Peninsula, Ohio, US of A
- Registered: 2003-02-06
- Posts: 237
- Website
definition list CSS selection
Is it possible to select an entire definition list item (dt and dd)? I see no way to do so. I can create a separate dl for each item, but this is far from ideal.
I hate your wimper
Offline
#2 2008-10-02 3:16 am
Re: definition list CSS selection
Code:
dl dt, dl dd {}Offline
#4 2008-10-02 4:20 am
Re: definition list CSS selection
Although I don't know what you want to do, I'm sure there's an elegant solution. If you want to style <dt> and <dd> exactly alike, you'll be better off using another list definition. If not, assign the shared properties to children of <dl>.
.tsooJ
Offline
#5 2008-10-03 4:26 am
- cosmicosmo
- Chancellor Mmmm

- From: Peninsula, Ohio, US of A
- Registered: 2003-02-06
- Posts: 237
- Website
Re: definition list CSS selection
It's not that I want to style them alike, it's that I want to style them together as a block. If I put a border around them and a background color, I want them to appear as a single entity instead of independent entities.
For my purposes, I can get the two to look seamlessly connected, at least in Firefox and Safari, just by:
•removing dd left margins
•adding padding to taste
•adding a bottom margin to the dd
I'll have to verify in Explorer, but I'm sure it'll work.
I hate your wimper
Offline
#7 2008-10-06 3:16 am
- cosmicosmo
- Chancellor Mmmm

- From: Peninsula, Ohio, US of A
- Registered: 2003-02-06
- Posts: 237
- Website
Re: definition list CSS selection
Sorry for the delayed response: My server is experiencing technical difficulties and I had to find another place to put my examples.
•With seperate dl's for each list item; done as intended for a class
•With regular list; with background added for demonstration purposes
The latter works fine, I was just hoping there was a direct way to access them as a block, rather than create the illusion that there is one.
I hate your wimper
Offline
#8 2008-10-14 5:20 pm
- Rozzlapeed
- Born to be IT

- From: Scottsdale, AZ
- Registered: 2003-01-02
- Posts: 1095
- Website
Re: definition list CSS selection
You won't be able to style them as a block so that they appear together as a block, because each element is styled individually. CSS does not define any group-based stying rules. Your only options are, as you said, limiting each <dl> to one pair of <dt><dd>, and styling the <dl>, or styling each <dt> to appear as the top half of a block and each <dd> as the bottom half.
"He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife."
-- Douglas Adams, The Hitch Hiker's Guide to the Galaxy
Offline
#9 2008-10-14 7:26 pm
- cosmicosmo
- Chancellor Mmmm

- From: Peninsula, Ohio, US of A
- Registered: 2003-02-06
- Posts: 237
- Website
Re: definition list CSS selection
I figured as much. That's the only set of tags I've run into thus far that grouping abilities would be nice, though I could see a few others benefiting as well. I only thought of the possibility because I'm used to using <ul> for most of my listing needs.
I hate your wimper
Offline
#10 2008-10-14 7:58 pm
- Rozzlapeed
- Born to be IT

- From: Scottsdale, AZ
- Registered: 2003-01-02
- Posts: 1095
- Website
Re: definition list CSS selection
I would suggest, however, that you try to go with the multiple <dl> tags option, in case you need a consistent style for <dl> lists that have multiple <dd>'s per <dt>.
"He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife."
-- Douglas Adams, The Hitch Hiker's Guide to the Galaxy
Offline
#11 2008-10-14 11:14 pm
- cosmicosmo
- Chancellor Mmmm

- From: Peninsula, Ohio, US of A
- Registered: 2003-02-06
- Posts: 237
- Website
Re: definition list CSS selection
hmm, I suppose that's a possibility, but I think I'll only do that in that case. I'd rather have the standard single list markup when possible.
I hate your wimper
Offline
#12 2008-11-28 11:50 am
Re: definition list CSS selection
Why not float the list-items over a seamless repeating background image? Or are you trying to make them stand separately?
-Tim
Offline
#13 2008-12-01 12:47 am
- cosmicosmo
- Chancellor Mmmm

- From: Peninsula, Ohio, US of A
- Registered: 2003-02-06
- Posts: 237
- Website
Re: definition list CSS selection
The idea was for each definition item to be treated as a separate and single entity, as a line item would be. So if I wanted a border around the definition item, ideally I'd be able to put something like:
di{ border: thin solid red; }
Likewise with any other attributes.
As it stands, for the above example, I'd need to create a top and a bottom half and join them together, like:
dd{ border: thin solid red; border-bottom: none; margin-left: 0; }
dt{ border: thin solid red; border-top: none; }
Browsers handle dd's and dt's with some default margins, so they would have to be managed to get the desired results.
More complex stylings would require more complex workarounds.
I hate your wimper
Offline

