Dl. Dt. DD implementation of the left and right layout simple example 1th/2 page _ Experience Exchange

Source: Internet
Author: User
Tags xmlns

This is a question that someone emailed today, the first idea is to use the UL list to achieve, but this is in the presence of two more troublesome places:

1, if the use of UL also layout, the right column more trouble;
2, text outside the border adaptive more trouble;
3, most likely to set the height of death;

So, a careful look at this layout, think about it or use DL.DT.DD is reasonable:

1, reasonable layout;
2, the future expansion is very convenient;
3, CSS must be very small;

Try to write, look at it is OK! Within the controllable range!

The layout of the cloth is of course needless to say:
Copy Code code as follows:

<div>
<dl>
<dt><a href= "HTTP://WWW.JB51.NET/ARTICLE/32" > blog article is written by myself! </a></dt>
<dd> Author: John </dd>
</dl>
<dl>
<dt><a href= "HTTP://WWW.JB51.NET/ARTICLE/32HTTP://WWW.JB51.NET/ARTICLE/32" > blog article is written by myself! </a></dt>
<dd> Author: John </dd>
</dl>
<dl>
<dt><a href= "HTTP://WWW.JB51.NET/ARTICLE/32HTTP://WWW.JB51.NET/ARTICLE/32" > blog article is written by myself! </a></dt>
<dd> Author: John </dd>
</dl&gt to the .....
</div>


CSS section:
Copy Code code as follows:

<style>
*{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;}
</style>
Look at the effect:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; Charset=utf-8 "/> <style> *{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;} </style> </pead> <body> <p>test</p> <div> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt&gT <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> </div> <p>test</p> <div> &LT;DL&G T <dt>, I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> I'm a girl! The article in the blog is I wrote it myself! </dt> <dd>xxx</dd> </dl> </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

What if the deal is wide?
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <pead> <meta http-equiv=" Content-type "content=" text/html; Charset=utf-8 "/> <style> *{margin:0; padding:0;} body{font-size:12px; line-height:1.8; padding:10px;} Dl{clear:both margin-bottom:5px;float:left;width:100%} dt,dd{padding:2px 5px;float:left border:1px solid #3366FF} dd{float:right} h1{clear:both;font-size:14px;} div{width:500px; float:left;} </style> </pead> <body> <p> title </p> <div> <dl> <dt> Blog The article is my own It's written! </dt> <dd> Author: John </dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd> Author: John </dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd> Author: John </dd> </dl> <dl> <dt> Blog Article I wrote it myself! &lT;/dt> <dd> Author: John </dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd>xxx</dd> </dl> </div> <p> title </p> <div> <dl> <dt> Blog article is my own writing! </dt> <dd>xxx</dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd>xxx</dd> </dl> <dl> <dt> Blog Article I wrote it myself! </dt> <dd>xxx</dd>;/dl> <dl> <dt> Blog articles are written by myself! </dt> <dd>xxx</dd> </dl> </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

Related examples, I've written one before:
Current 1/2 page 12 Next read the full text

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.