Go Back   Trackpads Community > General Discussions > Computer and Technology > Web Design

Web Design Forums and discussions on webdesign

Web Design

Reply
 
LinkBack Thread Tools
Old 02-01-2005, 16:00   #1 (permalink)
Dylan Parry
Civilians

 
Default Styling a definition list

Hi Folks,

I have a list of definitions, and I would like to display them like:

----
Example is blah blah blah.

Foo is blah blah blah.

Example2 is blah blah blah.
----

I figured that because they are definitions, that I really should
attempt to use a definition list element, but getting it to look how I
want it is proving difficult.

The closest I can get is by styling both dt and dd elements as inline,
and removing the left margins on the dd elements, but this also causes
all of the definitions to run into each other.

Any ideas?

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Trackpads Information
Click to Visit
Old 02-01-2005, 16:00   #2 (permalink)
Dylan Parry
Civilians

 
Default Re: Styling a definition list

Dylan Parry wrote:

> Any ideas?


Having just had a bright spark ignite inside my head, I thought of trying:

dt {
font-weight: bold;
float: left;
margin-right: 0.3em;
}
dd {
margin-bottom: 1em;
}

and is appears to work in IE5+, FF and Opera. Can anyone see any
potential problems here?

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-01-2005, 16:00   #3 (permalink)
Els
Civilians

 
Default Re: Styling a definition list

Dylan Parry wrote:

> Dylan Parry wrote:
>
>> Any ideas?

>
> Having just had a bright spark ignite inside my head, I
> thought of trying:
>
> dt {
> font-weight: bold;
> float: left;
> margin-right: 0.3em;
> }
> dd {
> margin-bottom: 1em;
> }
>
> and is appears to work in IE5+, FF and Opera. Can anyone
> see any potential problems here?


No, I'd just add margin-left:0; to the dd style, in case of any
dt being less then 3 characters.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-01-2005, 20:00   #4 (permalink)
Sally Thompson
Civilians

 
Default Re: Styling a definition list

On Tue, 01 Feb 2005 14:59:56 +0000, Dylan Parry
<usenet@dylanparry.com> wrote:

>Hi Folks,
>
>I have a list of definitions, and I would like to display them like:
>
>----
>Example is blah blah blah.
>
>Foo is blah blah blah.
>
>Example2 is blah blah blah.
>----
>
>I figured that because they are definitions, that I really should
>attempt to use a definition list element, but getting it to look how I
>want it is proving difficult.
>
>The closest I can get is by styling both dt and dd elements as inline,
>and removing the left margins on the dd elements, but this also causes
>all of the definitions to run into each other.


<delurk>
Far be it from me to offer help to my betters <g> but I came across
this site the other day:
<http://www.moronicbajebus.com/playground/cssplay/dl/>
Even if it's of no interest to you, it might be of interest to anyone
else trying to style a definition list. It seemed to have what I was
looking for, but haven't yet put into practice so don't know for sure.
</delurk>



--
Sally in Shropshire, UK
bed and breakfast near Ludlow: http://www.stonybrook-ludlow.co.uk
Reply To address is spam trap
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-02-2005, 08:00   #5 (permalink)
Dylan Parry
Civilians

 
Default Re: Styling a definition list

Els wrote:

> Might be easier to fix the line-height instead, as bold just
> takes up more line-height than not-bold. Not sure if it's always
> 0.1em margin that will fix it, but if you just set a line-height
> to both the bold and normal fonts, they should always be equal.


I tried that, but it didn't seem to work properly. The space disappeared
okay, and it was wrapped correctly, but the bold text appeared to be
~0.1em above the rest of the text. Not sure if I can explain it properly :\

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-02-2005, 08:00   #6 (permalink)
Els
Civilians

 
Default Re: Styling a definition list

Dylan Parry wrote:

> Els wrote:
>
>> Might be easier to fix the line-height instead, as bold
>> just takes up more line-height than not-bold. Not sure if
>> it's always 0.1em margin that will fix it, but if you just
>> set a line-height to both the bold and normal fonts, they
>> should always be equal.

>
> I tried that, but it didn't seem to work properly. The
> space disappeared okay, and it was wrapped correctly, but
> the bold text appeared to be ~0.1em above the rest of the
> text. Not sure if I can explain it properly :\


No need to explain, I saw it for myself.

Must say, that my initial trial version used Verdana as font,
and then there is no need for either line-height or bottom
margin to wrap correctly. It's when using Arial that the problem
starts. Might wanna check a bunch of fonts to see which behave
how.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vão. O resto é imperfeito.
- Renato Russo -
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-02-2005, 08:00   #7 (permalink)
Dylan Parry
Civilians

 
Default Re: Styling a definition list

Els wrote:

> Might wanna check a bunch of fonts to see which behave how.


Yeah. I've tried Arial on Windows, and Helvetica on Macs, and both seem
to display the same problem as I would have expected. I tend to avoid
using Verdana for reasons that are too numerous to discuss now.

Anyway, it all seems to work okay now in IE 5+, FF, Opera and Mac IE5.
In case you're interested, the final CSS I used was:

dt {
float: left;
font-weight: bold;
margin-bottom: -0.1em;
}

dl>dt { /* correct padding, not for IE */
padding-right: 0.3em;
}

dd {
margin-left: 0;
margin-bottom: 1em;
}

I added in the dl>dt bit because IE on both Windows and Mac was adding
in too much padding between the dt and dl, and it apparently has some
padding by default.

Cheers for your help though

--
Dylan Parry
http://webpageworkshop.co.uk -- FREE Web tutorials and references
 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Definition of the day... Manchu34 Humor 2 03-01-2007 18:39
[MV] definition of the word Stephen L Dussetschleger MV List 1 04-22-2006 00:35
Re: [MV] GL definition of 'triwall' jatonka MV List 0 04-21-2006 23:06
Poor styling problem automotive industry wide problem hunkman Automotive 9 11-26-2004 19:00
save definition zxcv BaseBall 1 10-22-2004 16:00


Community Information
Options
Quick Options
Trackpads Non-Commercial Ad
Copyright Information Click to Visit
Time
Server Time
All times are GMT -4. The time now is 11:06.
Copyright
Copyright Information
The header is based off of work by Vipixel.com and modified by this site. Trackpads and the Trackpads Logo are both Registered Trademarks of Jason Edwards and cannot be used without prior written permission.  The only exception is as a link back to this site. Trackpads is a private website run by a small legion of volunteers, 3 dogs, 12.5 cats and an army of small, super smart, bio-engineered mice with pointy hats and tutu's. Search Engine Friendly URLs by vBSEO 3.2.0 RC7
Archive Links
Archive Links
Page generated in 0.94504 seconds with 19 queries