2015-09-27 82 views
1

我在我的網站上有一個鏈接部分,但它有一個下劃線,所以我試過text-decoration: none;但無濟於事。有人可以幫我解決這個問題嗎?文字裝飾不影響超鏈接

代碼:

<div class="content2"> 
    <div class="twitterfeed"> 
    <h3>Twitter Feed</h3> 
    </div> 
    <div class="recent"> 
    <h3 class="text3">Recent News<span class="slash"> / </span><span class="text4">Get updates from us!</span></h3> 
    </div> 
    <div class="readnews"> 
    <a href="themes.goodlayers2.com/musicclub/blog-full-with-right-sidebar/"> <p class="readall"> Read All News </p></a> 
    </div> 
</div> 
<style type="text/css"> 

.content2 { 
    background: #191919; 
    padding-top: 10px; 
    padding-left: 25px; 
    padding-right: 20px; 
} 

.twitterfeed { 
    float: left; 
    padding-left: 140px; 
    color: white; 
    font-size: 30px; 
    font-family: Didot, Georgia, sans-serif; 
} 

.recent { 
    display: inline-block; 
    padding-left: 230px; 
} 

.readnews { 
    float: right; 
    color: white; 
    padding-right: 457px; 
    text-decoration: none; 
} 

.text3 { 
    color: white; 
    font-family: "Goudy Old Style", Optima, sans-serif; 
    font-size: 35px; 
    margin-bottom: 0; 
} 

.text4 { 
    font-size: 30px; 
    color: #6CB9D9; 
} 

.readall { 
    text-decoration: none; 
    color: white; 
} 
</style> 

回答

0
<a href="themes.goodlayers2.com/musicclub/blog-full-with-right-sidebar/" class="readall"> <p> Read All News </p></a> 

您可以保留p元素。

0

給周圍的錨標記類readall而不是段落。無論如何,我會擺脫這個p元素。

1

你有一個DIV元素至極包含一個至極含有P. 的DIV有文字裝飾類,但是你需要把它應用到A元素,所以你可以使用.readnews a{ text-deciration:none; } 在另一方面在HTML中,您不應該在INLINE元素(A標籤)內添加BLOCK元素(P標籤),所以這在技術上是錯誤的。無論如何,它會起作用,但是你將文本修飾:無應用到P,而你應該將它添加到A ... A標籤總是比任何其他元素更重要(談論CSS )。

如果您想保留您的HTML元素,您應該在P內部添加A,因此: DIV> P> A 然後將樣式添加到A標記。