2016-12-25 73 views
1

由於某些原因,我的樣式標籤無法在嵌入式CSS或HTML中拾取。字體族更改不會生效,也不會生效。有小費嗎?HTML/CSS樣式標籤無法正常工作

<!DOCTYPE html> 
<html> 
<head> 
    <title> 
     My Resume 
    </title> 
<style type=「text/css」> 

#ob { 
    border-top: 5px solid black; 
} 

</style> 
</head> 

<body> 
    <div> 
     <h1 style=「font-family: sans-serif」> 
      <strong>Corey Schnedl </strong> 
     </h1> 

     <h4 style=「font-family: Sans-Serif」> 
      <strong> XXXXXXXXXXX/XXXXXXXX/XXXXX/XXXXX </strong> 
      <br> 
      <strong>XXXXXXXXXXXXX</strong> 
     </h4> 
    </div> 

    <div> 
     <h3 style=「font-family:Arial」> 
      <strong>Objective</strong> 
     </h3> 
     <p> 
      To obtain an entry-level position as a Java software developer. 
    </div> 

</body> 


</html> 
+0

Atom是一個文本編輯器,我經常看到它被推薦給初學者。 – therobinkim

+0

請參閱http://apple.stackexchange.com/questions/120486/quotes-problem-in-mavericks-or-textedit。 – 2016-12-25 07:21:13

+0

通過驗證程序運行您的HTML。 – 2016-12-25 07:22:32

回答

4

使用純文本引號。這"

四次出現是破壞你的代碼:

  • <style type=「text/css」>
  • <h1 style=「font-family: sans-serif」>
  • <h4 style=「font-family: Sans-Serif」>
  • <h3 style=「font-family:Arial」>

<!DOCTYPE html> 
 
    <html> 
 
    <head> 
 
     <title> 
 
      My Resume 
 
     </title> 
 
    <style type="text/css" rel="stylesheet"> 
 
    
 
    #ob { 
 
     border-top: 5px solid black; 
 
    } 
 
    
 
    </style> 
 
    </head> 
 
    
 
    <body> 
 
     <div> 
 
      <h1 style="font-family: sans-serif"> 
 
       <strong>Corey Schnedl </strong> 
 
      </h1> 
 
    
 
      <h4 style="font-family: Sans-Serif"> 
 
       <strong> XXXXXXXXXXX/XXXXXXXX/XXXXX/XXXXX </strong> 
 
       <br> 
 
       <strong>XXXXXXXXXXXXX</strong> 
 
      </h4> 
 
     </div> 
 
    
 
     <div> 
 
      <h3 style="font-family:Arial"> 
 
       <strong>Objective</strong> 
 
      </h3> 
 
      <p> 
 
       To obtain an entry-level position as a Java software developer. 
 
     </div> 
 
    
 
    </body> 
 
    
 
    
 
    </html>

+0

哇謝謝,我甚至沒有意識到,但是每次我輸入「它會自動將其更改爲」即使我在TextEdit的設置中選擇了純文本。 –

+0

投票結束爲排印錯誤? – 2016-12-25 07:21:54

1

編輯本:

<style type="text/css" rel="stylesheet"> 

style="font-family:'Arial';" 

放一個分號每style屬性

這裏是你的編輯頁面

<!DOCTYPE html> 
<html> 
<head> 
    <title> 
     My Resume 
    </title> 
<style type="text/css" rel="stylesheet"> 
#ob { 
    border-top: 5px solid black; 
} 

</style> 
</head> 

<body> 
    <div> 
     <h1 style="font-family: sans-serif;"> 
      <strong>Corey Schnedl </strong> 
     </h1> 

     <h4 style="font-family: Sans-Serif;"> 
      <strong> XXXXXXXXXXX/XXXXXXXX/XXXXX/XXXXX </strong> 
      <br> 
      <strong>XXXXXXXXXXXXX</strong> 
     </h4> 
    </div> 

    <div> 
     <h3 style="font-family:Arial;"> 
      <strong>Objective</strong> 
     </h3> 
     <p> 
      To obtain an entry-level position as a Java software developer. 
    </div> 

</body> 
</html> 
012結束

使用驗證程序是檢查syntex錯誤的好主意。這裏https://validator.w3.org/#validate_by_input

+0

你也忘了另外兩個。 :) –

+1

有四個錯誤發生,只有一個樣式,分號不是必需的:) –

+0

他現在只嘗試一個,但也會添加其他的。最好從一開始就遵循最佳實踐。 – ab29007