2017-04-19 31 views
-1

我遇到問題,將範圍從外部CSS文件添加到span標記到以下HTML代碼片段。從<span>在外部文件中添加樣式

<!DOCTYPE html> 
 
<html> 
 
\t <head> 
 
\t \t <link type="text/css" rel="stylesheet" href="stylesheet.css"/> 
 
\t \t <title>About Me</title> 
 
\t </head> 
 
\t <body> 
 
\t \t <img src="https://s3.amazonaws.com/codecademy-blog/assets/46838757.png"/> 
 
\t \t <p>We're Codecademy! We're here to help you learn to code.</p><br/><br/> 
 
\t \t <div> 
 
\t \t <a href="www.google.com"><span>LINK</span></a> \t 
 
\t \t </div> 
 
\t </body> 
 
</html>

相應的CSS低於;似乎有問題的線處於跨度塊,這對於一些原因沒有被施加文字修飾線。任何輸入?

img { 
 
\t display: block; 
 
\t height: 100px; 
 
\t width: 300px; 
 
\t margin: auto; 
 

 
} 
 

 
p { 
 
\t text-align: center; 
 
\t font-family: Garamond, serif; 
 
\t font-size: 18px; 
 
\t 
 
} 
 

 
/*Start adding your CSS below!*/ 
 

 
div { 
 
    height: 50px; 
 
    width: 120px; 
 
    border-color: #6495ED; 
 
    background-color: #BCD2EE; 
 
    border-style: dashed; 
 
    border-width: 3px; 
 
    border-radius: 5px; 
 
    margin: auto; 
 
    text-align: center; 
 
    
 
} 
 

 
span { 
 
    color: blue; 
 
    font-family: times; 
 
    text-decoration: none; 
 
}

+0

的可能的複製[拔下鏈接下劃線頑固(http://stackoverflow.com/questions/2789703/remove-固執 - 底線 - 從鏈接) –

回答

0

這條線是從錨標記,而不是從跨度。檢查下面的CSS:

img { 
 
    display: block; 
 
    height: 100px; 
 
    width: 300px; 
 
    margin: auto; 
 
} 
 

 
p { 
 
    text-align: center; 
 
    font-family: Garamond, serif; 
 
    font-size: 18px; 
 
} 
 

 

 
/*Start adding your CSS below!*/ 
 

 
div { 
 
    height: 50px; 
 
    width: 120px; 
 
    border-color: #6495ED; 
 
    background-color: #BCD2EE; 
 
    border-style: dashed; 
 
    border-width: 3px; 
 
    border-radius: 5px; 
 
    margin: auto; 
 
    text-align: center; 
 
} 
 

 
span { 
 
    color: blue; 
 
    font-family: times; 
 
} 
 

 
a { 
 
    text-decoration: none; 
 
}
<!DOCTYPE html> 
 
<html> 
 
\t <head> 
 
\t \t <link type="text/css" rel="stylesheet" href="stylesheet.css"/> 
 
\t \t <title>About Me</title> 
 
\t </head> 
 
\t <body> 
 
\t \t <img src="https://s3.amazonaws.com/codecademy-blog/assets/46838757.png"/> 
 
\t \t <p>We're Codecademy! We're here to help you learn to code.</p><br/><br/> 
 
\t \t <div> 
 
\t \t <a href="www.google.com"><span>LINK</span></a> \t 
 
\t \t </div> 
 
\t </body> 
 
</html>

0

使用此

a { 
    color: blue; 
    font-family: times; 
    text-decoration: none; 
} 
+0

「文字裝飾」可以適用於任何元素,而不僅僅是錨。 –

+0

奇怪的是,我在Code Academy中添加了同樣的塊,但它不想申請某些原因。你有沒有聽說過類似的問題? –

+0

可能是從其他定義的CSS或庫重寫 你可以嘗試text-decoration:none!important; –