Div + CSS layout example: Use dl dt dd to create a list

Source: Internet
Author: User
Document directory
  • Tags:
When using DIV + CSS to create a list, we usually use ul and li to compile the list. However, there are two troublesome scenarios:

1. If UL is used for layout, the right column is troublesome;
2. It is difficult to adapt the border outside the text;
3. It is very likely that the height should be fixed;

So, let's take a closer look at this layout and think it's reasonable to use DL. DT. DD:

1. reasonable layout;
2. Future expansion is very convenient;
3. CSS must be rare;

I tried to write it. It's okay to have a look! Within the controllable range!

Needless to say:

The source code is as follows:

Use DL, DT, and DD to create a list

<H1> title <Div>
<Dl>
<Dt> <a href = "32"> · I wrote my own blog articles! </A> </dt>
<Dd> author: James Zhang </dd>
</Dl>
<Dl>
<Dt> <a href = "3232"> · I wrote my own blog articles! </A> </dt>
<Dd> author: James Zhang </dd>
</Dl>
<Dl>
<Dt> <a href = "3232"> · I wrote my own blog articles! </A> </dt>
<Dd> author: James Zhang </dd>
</Dl> ...........
</Div>
 

 

CSS Section

* {Margin: 0; padding: 0 ;}
Body {font-size: 12px; line-height: 1.8; padding: 10px ;}
Dl {clear: both; margin-bottom: 5px; float: left ;}
Dt, dd {padding: 2px 5px; float: left; border: 1px solid # 3366FF}
Dd {position: absolute; right: 5px ;}
H1 {clear: both; font-size: 14px ;}
 

 

Tags:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.