2013-10-18 105 views
-2

I have the following section of code:缺少下劃線<a href> and <u>

echo "<form> 
      <div id=\"error\"align=\"center\">"; 
    echo "You've either key-ed in the wrong <b>username</b> or wrong <b>password</b>. <br/>"; 
    echo "Please contact person in-charged or click <u><a href=\"login.php\">here</a></u> to login again."; 
    echo "</div></form>"; 

and the corresponding CSS:

#error{ 
font-family: "Acens", Verdana, Tahoma; 
background: -webkit-linear-gradient(#fff, #2f4f4f); 
-webkit-background-clip: text; 
-webkit-text-fill-color: transparent; 
} 

html, body { 
    height:100%; 
    width:100%; 
    margin:0px; 
} 
body { 
    display:table; 
    vertical-align:middle; 
} 
form { 
    display:table-cell; 
    vertical-align:middle; 
    width:240px; 
    margin:0px auto; 
} 

The output:

enter image description here

And shown in the image, there isnt any underline at here which was expected. However, it still able to direct user to another page.

+0

某處在你的CSS你是文本裝飾設置爲none –

+0

你爲什麼加入標籤。 link應該爲你加下劃線。 –

+0

你應該爲你的CSS添加'text-decoration:underline;'爲'#error a' – BrownEyes

回答

3
+0

它至少會讓你知道它是否是優先問題 – wetjosh

+0

yes,true。我相信有一個text-decoartion的聲明:沒有任何地方。可能是@Isaac正在使用第三方樣式表。 – Oxon

+0

@ user1576573:我在我的樣式表中逐行掃描並確保沒有'text-decoration:none'並且您的方式不起作用 –

0

What if you try to manually set the underline in the css

a { 
    text-decoration: underline 
    } 
+0

試過了,沒有運氣。 –

0

add a style

a:link { 
text-decoration: underline; 
} 

to your stylesheet. Like @patsy says, somewhere you've removed it. And put it at the end of the stylesheet to be safe (so that if comes after the rule where it was removed).

+0

試過,仍然沒有出現 –

0

Add this style

#error a { 
    text-decoration:underline !important; //override 
} 
+0

'!important'必須在分號前出現。 – str

+0

@str:甚至在分號仍然不起作用之前放上'!important' –

+0

抱歉,錯字檢查現在@str – sun

0

也許這是您使用的自定義字體的問題,Acens

嘗試使用另一種方法,一種「黑客」 - 添加到您的CSS:

#error a{ 
    border-bottom:1px solid #000; 
} 
+0

尼斯嘗試,它顯示的邊界,但它不看起來像一個下劃線,它是非常醜陋的哈哈。所以也許自定義字體會以某種方式刪除下劃線? –

+0

@IsaacLem我認爲字體可能會導致問題,請嘗試更改爲'Arial',看下劃線是否出現。而使用'padding'和'width'等CSS屬性可以幫助你將邊框底部看起來像一個真正的下劃線:) – BrownEyes