2016-11-26 154 views
0

我正在爲WordPress寫一個插件,當我添加鏈接時,下劃線不會消失。我正在使用的主題是二十六個。這裏是我的html:鏈接下劃線不會消失

<a class="thisisunique" href="#" style="text-decoration:none;">some text</a> 

我感到非常詫異,這是不行的,因爲text-decoration甚至內聯。我也包括這在我的CSS:

a.thisisunique, a.thisisunique:link, a.thisisunique:visited, a.thisisunique:hover, a.thisisunique:active, a.thisisunique:focus { 
    text-decoration: none !important; 
} 

我甚至包括從主題(https://wordpress.org/support/topic/remove-underline-from-links-2/),誰解釋說,主題不使用text-decoration的開發代碼,但border-bottom達到下劃線(無論何種原因) :

.entry-content a, .entry-summary a, .page-content a, .comment-content a, .pingback, .comment-body > a, .textwidget a { 
    border-bottom: none; 
} 

但唉,混淆下劃線依然存在。

還有什麼奇怪的是,當我做text-decoration: overline;時,它實際上是在鏈接上添加了overline。

我錯過了什麼?

+0

您是否已清除瀏覽器緩存? – user2182349

+0

您提出了一個有趣的觀點:當我修改主題以查明發生了什麼時,我注意到沒有任何變化。原來他們被緩存了,所以我必須每次清除緩存。 –

回答

1

,我會告訴你,你錯過了什麼!:

.entry-content a, 
.entry-summary a, 
.taxonomy-description a, 
.logged-in-as a, 
.comment-content a, 
.pingback .comment-body > a, 
.textwidget a, 
.entry-footer a:hover, 
.site-info a:hover { 
    box-shadow: 0 1px 0 0 currentColor; 
} 

哪裏box-shadow: 0 1px 0 0 currentColor;是爲這一切負責槍的兒子!

到底是什麼box-shadow?爲什麼???

這是我在挖掘整個WordPress目錄一小時後發現的。上面的代碼位於主題的 style.css文件中。無論如何,只是在做

box-shadow: none; 

終於擺脫了那個強調下劃線。

+0

'box-shadow'有時用於下劃線,因爲它可以給出不同的結果,有些則認爲標準文本修飾更好看。這當然更「風格化」。 ['border-bottom'和'text-shadow'可以以類似的方式使用](https://walterebert.com/blog/underlined-links-css3-box-shadow-text-shadow/)。 –

+0

啊好的。我對HTML和CSS仍然很陌生,所以它可能就是我。 –

0

嘗試使樣式更具體,如: .widget-area .widget .link-style-1:visited { color:green; } 如果可能分享鏈接的位置..

{ parent. a.thisisunique, 
    parent. a.thisisunique:link, 
    parent. a.thisisunique:visited, 
    parent. a.thisisunique:hover, 
    parent. a.thisisunique:active, 
    parent. a.thisisunique:focus { 
    text-decoration: none !important; 
    }