开发者

Is it possible to make Unordered list like this using CSS?

开发者 https://www.devze.com 2022-12-24 14:52 出处:网络
Is it possible top make an unordered list in this image ? I cant use 2 images for single <li> tag

Is it possible top make an unordered list in this image ?

Is it possible to make Unordered list like this using CSS?

I cant use 2 images for single <li> tag

If I use arrow as background and pa开发者_JS百科dding-left then the border-bottom will come under image as well.

I cant use margin-left and background-position too I guess ?

Any ideas ?

Thanks


I've uploaded an example for you that you can view and download at: http://joegreen.co.uk/stackoverflow/img-list/img-list.html

Here's the CSS and markup for reference. It's been tested in Firefox 3.6, Safari 4, Chrome, IE7 and IE8.

CSS:

#list-container {
    width: 460px;
    padding: 15px 15px 15px 30px;
    background-color: #f6f4ea;
    border: 1px solid #e3e1d5;
    font: 12px Verdana, Geneva, sans-serif;
}

#list-container ul {
    list-style: disc outside url('./bullet.gif');
    margin: 0;
    padding: 0;
}

#list-container ul li {
    margin: 7px 0 0 0;
    padding: 0 0 7px 0;
    border-bottom: 1px dotted #7a7974;
}

HTML:

<div id="list-container">
    <ul>
        <li>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</li>
        <li>Donec tellus felis, euismod non egestas sed, suscipit a leo. Ut quis augue vel mauris mollis volutpat.</li>
        <li>Morbi varius porttitor massa, sed lobortis magna ornare et.</li>
        <li>Fusce blandit risus varius felis posuere vehicula iaculis turpis bibendum. Integer a molestie nunc.</li>
        <li>In blandit neque ac dui laoreet tincidunt dapibus leo pulvinar. Sed nec ligula non orci vulputate vulputate.</li>
    </ul>
</div>


This is a way to use images as bullet points ...

http://css.maxdesign.com.au/listutorial/11.htm (see code pasted below.)

The only thing you'd need to add after that is bottom dotted borders to each list item (should be pretty easy.)

.iconlist
{
list-style: none;
margin: 0;
padding: 0;
}

li.pdf
{
background-image: url(bullet_pdf.gif);
background-repeat: no-repeat;
background-position: 0 50%;
padding: 3px 0 3px 20px;
margin: .4em 0;
}

li.doc
{
background-image: url(bullet_doc.gif);
background-repeat: no-repeat;
background-position: 0 50%;
padding: 3px 0 3px 20px;
margin: .4em 0;
}

li.text
{
background-image: url(bullet_text.gif);
background-repeat: no-repeat;
background-position: 0 50%;
padding: 3px 0 3px 20px;
margin: .4em 0;
}

li.htm
{
background-image: url(bullet_htm.gif);
background-repeat: no-repeat;
background-position: 0 50%;
padding: 3px 0 3px 20px;
margin: .4em 0;
}

HTML CODE
<ul class="iconlist">
<li class="pdf"><a href="#">Milk</a></li>
<li class="text"><a href="#">Eggs</a></li>
<li class="htm"><a href="#">Cheese</a></li>
<li class="doc"><a href="#">Vegetables</a></li>
<li class="text"><a href="#">Fruit</a></li>
</ul>


Use:

list-style-image:url("/images/arrow.gif");

with margin and border on the lis.

0

精彩评论

暂无评论...
验证码 换一张
取 消