0

我正在尝试针对功能列表。在我的CSS中,我有:

.skills .about {
    width: 490px;
    text-align: justify;
    line-height: 20px;
    /*letter-spacing: 0px;*/

}   

    .skills .about ul li {
        display: none;
    } 

我不知道如何针对特定的 UL 列表。我需要更改line-height列表以匹配line-height班级.skills .about。我该怎么做?

<div id="about">
    <div class="aboutText">
        <h1>Who's Sam Jarvis?</h1>
        <div class="skills">
            <span class="h2span"><h2>Bio</h2></span>
            <p class="about">
                I’m a Freelance Designer currently working out of Holland Landing, Ontario. Over the last three years I’ve spent my time as a Graphic Design student at Seneca@York honing my skills and creating many of the works that are currently in my portfolio. The creative field is where I strive and though I get paid to design I also dabble in photography, illustration, playing guitar and <strong>wheeled foot maneuvers</strong>.
            </p>
            <h2>Education</h2>
            <p class="about">
                Advanced Diploma in Graphic Design
                Seneca College of Applied Arts and Technology
            </p>
            <h2>Capabilities</h2>
            <p class="about">
                <ul>
                    <li>Branding & Art Direction</li>
                    <li>Interface Design</li>
                    <li>Adobe Creative Suite</li>
                    <li>Web Standards & Accessibility</li>
                </ul>
            </p>
        </div>
    </div>
</div>
4

2 回答 2

1

根据HTML 标准,该p元素在任何“块级”元素之前隐式关闭,包括ul. 所以你的标记实际上相当于

    <h2>Capabilities</h2>
    <p class="about">
    </p><ul>
         <li>Branding & Art Direction</li>
         <li>Interface Design</li>
         <li>Adobe Creative Suite</li>
         <li>Web Standards & Accessibility</li>
    </ul>
    <p></p>

ul的直接兄弟p.about

.about + ul { ... }

但是将.about类设置为ul自身不是更容易吗?

于 2013-07-21T19:58:33.387 回答
0
.about li {line-height: 20px}

或者,如果您想更具体:

.skills > .about li {line-height: 20px}
于 2013-07-21T20:31:50.260 回答