2016-12-26 166 views
-1

我在Windows記事本使用CSS時遇到了以下問題:CSS樣式類問題

<!DOCTYPE html> 
    <html> 
     <head> 
      <title>RYZJMScience</title> 
      <style> 
       #title { 
        display: block; 
        margin: 0px auto; 
       } 
       .page { 
        text-decoration: none; 
        display: inline; 
        font: "Georgia, serif; 
        font-size: 40px; 
        font-color: rgb(0,0,205); 
        border: 2px 1px 1px 1px solid rgb(255,140,0); 
       } 
      </style> 
     </head> 
     <body> 
      <img src="title.png" id="title"> 
      <a href="index.html" class="page">Home</a> 
      <a href="weekly.html" class="page">Weekly</a> 
      <a href="monthly.html" class="page">Monthly</a> 
      <a href="physics.html" class="page">Physics</a> 
      <a href="chemistry.html" class="page">Chemistry</a> 
      <a href="biology.html" class="page">Biology</a> 
      <a href="technology.html" class="page">Technology</a> 
     </body> 
    </html> 

當這個運行時,該班級。第選擇下工作的唯一的事情是用於文本裝飾聲明刪除鏈接的下劃線。請幫忙!

回答

2

這條線:

font: "Georgia, serif; 

應該是:

font-family: "Georgia", serif; 

此外,設置字體顏色屬性是color而不是font-color,並且邊框屬性需要被分割。

所以你page類應該是這樣的:

.page { 
    text-decoration: none; 
    display: inline; 
    font-family: "Georgia", serif; 
    font-size: 40px; 
    color: rgb(0,0,205); 
    border-width: 2px 1px 1px 1px; 
    border-style: solid; 
    border-color: rgb(255,140,0); 
} 
1

檢查this小提琴。

CSS

改變我做:

font: "Georgia, serif; 

font-family: Georgia, serif; 

font-color: rgb(0,0,205); 

color: #0000cd; 

border: 2px 1px 1px 1px solid rgb(255,140,0); 

border-top-width: 2px; 
border-right-width: 1px; 
border-bottom-width: 1px; 
border-left-width: 1px; 
border-color:rgb(255,140,0); 
border-style: solid; 

更多的相關信息:

Fonts

Font colors

Borders

希望能幫助你。

3

由於每次在CSS中找不到語法錯誤時都無法發佈到SO,因此您需要更好的方法。

您可以使用知名CSS的高級編輯器或IDE,並且可以在屏幕上爲您突出顯示錯誤。這是VSCode的屏幕截圖。您可以從什麼是錯的着色告訴:

enter image description here

或者,你可以通過CSS棉短絨運行你的CSS,或驗證,如W3C CSS Validator。它會告訴你:

enter image description here

大多數Web瀏覽器也將報告你的錯誤,無論是在解析錯誤的形式,或在樣式檢查出未知的屬性名稱或無效的屬性值的形式。瞭解如何使用它。下面是它的樣子:

enter image description here

懸停在小黃三角將顯示該問題的詳細信息,如「未知屬性名稱」或「無效的屬性值」。