李格式化文本的问题请帮忙?

时间:2011-09-08 15:51:08

标签: html css drop-down-menu html-lists

我有一个下拉菜单,其中的分钟在菜单的不同部分上方有不同的彩色标题,例如

标题(colour1)

option1(colour2)

(上方和下方)

我想更改它,以便在列表中看起来如下(一行上有两种颜色):

标题(colour1)选项1(颜色2)

(并排)

我之前问了一个问题,如何解决这个问题并得到答案。然而,列表项目仍然是上下而不是并排。

css看起来像这样:

#drop {
    font-size: 12px;
    font-weight:bold;
    position: fixed;
    z-index:inherit;
    left: 183px;
    width:700px;
    top: 15px;
    }

#drop ul {
    background: #fff;
    list-style-type: none;      
    }

#drop ul li {
    width: 750px;
    float: left;
    list-style-type: none;      
    margin: 0 10px -10 0;
    }

#drop ul li span {
    display: block;
    list-style-type: none;      
    padding: 1px 3px;
    }

#drop ul li ul {
    background: #fff;
    opacity: 0.9;
    list-style-type: none;      
    display: none; 
    padding: 0 0em 0.5em 0;
    }

#drop ul li:hover ul {
    list-style-type: none;      
    opacity: 0.9;
    }

#drop ul li ul li {
    border: none;       
    list-style-type: none;  
    float: none;
    padding-left:0px;
    }

#drop ul li ul li a {
    display: block;
    color: #808285;
    text-decoration: none;
    cursor:pointer;
    }


#drop ul li ul li a:hover {
    background: #d8d8dc;
    }


#drop ul li.section-title SPAN.section-title {
    color:#434442;
    margin-left: -3px;
    }

span.nav-title {
    border-bottom: 1px solid #808285;   
    position:fixed;
    left: 223px;
    width:744px;
    top: 28px;
    cursor:pointer;

    }

这样的Html:

<div id="dropbox"></div>
                    <div id="Dropp style="position:relative;z-index:1000">
<div id="drop" style="position:absolute;z-index:3000">
    <ul>
        <li id="dropbox"><span class="nav-title" style="z-index:3000">Deutsche Börse Photography Prize 2011</span> <div class="nav-title" id="triangle">
                    </div>
            <ul id="ddd" class="subnav" style:"display: none;" >
                <br>
            <br>
            <br>
            <li>—</li>
            <li class="section-title">
                <span class="section-title">Photographers Gallery</span>
            </li>
                <li><a href="Deutsche Börse Photography Prize 2011.html">Deutsche Börse Photography Prize 2011</a></li>
                <li><a href="#">Deutsche Börse Photography Prize 2010</a></li>

这里有一个例子: www.deanpauley.co.uk/O-SB/categories.html

我给出的建议是将其改为:

<ul>
    <li class="section"><span class="title">Title 1</span><span class="content">Color 2</span></li>
    <li class="section"><span class="title">Title 1</span><span class="content">Color 2</span></li>
    <li class="section"><span class="title">Title 1</span><span class="content">Color 2</span></li>
</ul>

有人可以帮忙吗?是否与文本不会在同一行上的填充/边距有关?

1 个答案:

答案 0 :(得分:0)

不确定这是否正是您的意思,但它会达到我想要的效果!

<ul>
    <li class="section" style="overflow:hidden">
        <span class="title" style="display:block; float:left; width:somewidth">Title Color 1</span>                        
        <ul class="content" style="width:somewidth; float:left">
            <li>Content Color 2</li>
            <li>Content Color 2</li>
            <li>Content Color 2</li>
            <li>Content Color 2</li>
        </ul>
    </li>
</ul>

原谅内联样式,但今天下午我很懒:)

这将导致:

标题颜色1 - &gt; 内容颜色2
                 - &gt; _ __ _ __ _ ___ 内容颜色2
                - &gt;
__ _ __ _ __ _ __ 内容颜色2
                - &gt; _ __ _ __ _ ____ 内容颜色2

将'somewidth'替换为您需要的宽度 - 与使用自动宽度相比,它将保持更均匀和更少的错误。但是你可以使用自动宽度并为ie6添加样式 - 它不会玩球!

相关问题