How to create a news list in webpage layout using DIV + CSS

Source: Internet
Author: User

CSS code:

The code is as follows: Copy code
. List {
Margin: 0px 10px 20px;
Text-align: left;
}
. List ul {
List-style-type: none;
Margin: 0px;
Padding: 0px;
}
. List li {
Background: url (/news/images/line.gif) repeat-x bottom;
/* Dotted line at the bottom of the list */
Width: 100%;
}
. List li {
Color: #777777;
Display: block;
Padding: 6px 0px 4px 15px;
Background: url (/news/images/dot.gif) no-repeat 0 6px;
/* Arrows on the left of the list */
}
. List li span {
Float: right;/* float the span element to the right */
Text-align: right;/* right-aligned date */
}
. List li a: hover {
Color: #336699;
Background: url (/news/images/dot2.gif) repeat-x bottom;
}

Note: The span must be placed in front. Otherwise, a line break is generated.
XHTML:

The code is as follows: Copy code
<Ul class = "list">
<Li> <span> August 1, May 30, 2005 </span> <a href = "#"> News title 01 </a> </li>
<Li> <span> March May 30, 2005 </span> <a href = "#"> News title 02 </a> </li>
<Li> <span> March May 30, 2005 </span> <a href = "#"> News title 03 </a> </li>
<Li> <span> March May 30, 2005 </span> <a href = "#"> News title 04 </a> </li>
</Ul>

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.