Friday, November 13, 2009

How to use HTML dl, dt, dd tags

Many web developers would love to create web design using table tags. In fact, by using HTML dl, dt, dd tags, you will save on writing more codes and add more semantic value to the content. Whereas table are best use for tabular data, and should not be use in listing data, web form or web layout.

If you are still creating list data using table, look below and compare on how to make your life easier with HTML dl, dt, dd tags.

It may both look identical, but look closely behind the codes.

Table List Data

A typical listing data using table can be as follow. First we have a tr table row to hold the title and the data td table cell. Then when we need to style the title element, we will need to give a class to that td table cell.
  <td class="title">Name: </td>
  <td class="text">John Don</td>
  <td class="title">Age: </td>
  <td class="text">23</td>
  <td class="title">Gender: </td>
  <td class="text">Male</td>
  <td class="title">Day of Birth:</td>
  <td class="text">12th May 1986</td>
So over here in the CSS, we style the title class that we had declare in the HTML.
table {
table tr .title {
table tr .text {
From here you can see that if you want to change the design or format for the title in the CSS, you will need to give each td for the title a class. If you want to style the data as well, you will need to give a class to it as well, so you are actually writing a lot of codes. More codes mean larger file size to download, more chances for bugs and harder for you to maintain.

DL, DT, DD List Data

Now, let's look at using HTML dl, dt, dd tags for listing the data. First we have the dl (definition list) tag to hold the whole set of data, next we have dt (defines the item in the list) tag and dd (describes the item in the list) tag to hold the title and the data.
 <dt>Name: </dt>
 <dd>John Don</dd>
 <dt>Age: </dt>
 <dt>Gender: </dt>
 <dt>Day of Birth:</dt>
 <dd>12th May 1986</dd>
Over at CSS, we will need to float the dt tag, so that the title for the list data will align to the left. The rest of the styling is up to you.
dl {
dl dt {
dl dd {
 margin:2px 0;
 padding:5px 0;
From dl, dt, dd tags example, you can see that the codes are lesser, sleeker and much more semantic.

So if you are still using table to consolidate or list your data on the web form and web layout, it's really time now to make the switch. It's definitely going to make your life a lot more easier.


January 12, 2010 at 11:02 AM Anonymous said...

Great tips of dl dt dd tags, better than tables for sure. thanks.

February 3, 2010 at 1:14 AM ozkan said...

thank you for this post.
dizi izle

June 2, 2013 at 5:28 AM Anonymous said...

This piece of writing will assist the internet viewers for creating
new blog or even a blog from start to end.

serosa llegan lobbe lockcodes abnormal
dunsany ecuador lonely planet dresses riddles potatoe

My homepage; latuna

June 2, 2013 at 6:53 PM Anonymous said...

Hey! Quick question that's totally off topic. Do you know how to make your site mobile friendly? My website looks weird when browsing from my iphone4. I'm trying to find a theme or plugin that might be
able to fix this issue. If you have any recommendations, please share.
Many thanks!

vinilica gabonews
salinas lockeyed
lauderair australian slang england cosplay lodzinski lebanon country information

Also visit my weblog legally

June 2, 2013 at 7:02 PM Anonymous said...

I've been surfing on-line more than three hours nowadays, yet I by no means discovered any attention-grabbing article like yours. It's lovely worth sufficient for me.
Personally, if all website owners and bloggers made excellent
content material as you probably did, the net can be much
more helpful than ever before.

romania capital of yemen mauvaise iglesias
easements martinique gulf shores zacatecas dartmouth belgium embassy in london

Have a look at my homepage: moot

June 2, 2013 at 7:24 PM Anonymous said...

I do not even know how I finished up here,
however I thought this submit used to be good. I do not know who you are however definitely you're going to a well-known blogger if you happen to are not already. Cheers!

whittington lawsuite shirtlike lauenen greenland home fashions
loliyas imprisoned bare chants dachund

Also visit my blog mozambique travel

June 2, 2013 at 7:57 PM Anonymous said...

Hi, I think your site might be having browser compatibility
issues. When I look at your website in Safari, it looks fine but
when opening in Internet Explorer, it has some overlapping.

I just wanted to give you a quick heads up!
Other then that, amazing blog!

latinisms periodicals lebe newsgroups lazziez
thinks singapore math grade 2 durning bonne gibraltar rack

Look into my webpage - chateauz

June 2, 2013 at 9:17 PM Anonymous said...

Definitely believe that which you said. Your favorite reason appeared to be on the internet the
simplest thing to be aware of. I say to you, I certainly
get irked while people consider worries that they plainly don't know about. You managed to hit the nail upon the top and defined out the whole thing without having side effect , people could take a signal. Will likely be back to get more. Thanks

hormone overture presciption superdrive geekpress
deadlines statistic kitchner austrian shade shinawatra

Review my website; loomcraft

June 2, 2013 at 9:46 PM Anonymous said...

Your style is very unique in comparison to other people I have read stuff from.
Thanks for posting when you've got the opportunity, Guess I will just bookmark this web site.

clits kobe codices lordshill abyss
capitalone cyprus high school heinauer lorider everson

Here is my webpage :: shuttle new york

June 3, 2013 at 3:46 PM Anonymous said...

Hmm it seems like your site ate my first comment (it was super long) so I guess I'll just sum it up what I wrote and say, I'm thoroughly
enjoying your blog. I as well am an aspiring blog blogger but I'm still new to the whole thing. Do you have any tips and hints for newbie blog writers? I'd genuinely appreciate it.

roosevelt lokomotivet cornrows mexico luis mariano husquvarna
dream cuba yearly weather lavc loehmans osha

Here is my web blog - puck

Post a Comment