2013-07-21 43 views
0

我試圖定位功能列表。在我的CSS我有:針對具體的嵌套UL列表與css

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

} 

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

我不知道如何針對該特定UL列表。我需要更改列表的line-height以匹配.skills .about類的line-height。我將如何做到這一點?

<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 [email protected] 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> 
+3

你不能有UL裏面P.同爲內SPAN H2。 –

+0

'.skills'應該是UL元素。 –

+0

使用[HTML驗證程序](http://validator.w3.org/)檢查您的標記。 – Vucko

回答

1

根據該HTML standard,所述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> 

ulp.about眼前的兄弟姐妹:

.about + ul { ... } 

但不會是更容易只是.about類設置爲ul本身?

0
.about li {line-height: 20px} 

或者,如果你想更具體:

.skills > .about li {line-height: 20px}