2016-06-12 215 views
-1

我試圖運行包含css標籤的html文件。但在輸出中,我只能看到html標籤的輸出,而不是css標籤。我已經在所有瀏覽器中嘗試了這一點,可以知道問題所在。CSS腳本不能正常工作

這是我的文件:

<?xml version=」1.0」 encoding=」UTF-16」?> 
<!DOCTYPE html PUBLIC 「-//W3C//DTD XHTML 1.1//EN」 
「http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd」> 
<html xmlns=」http://www.w3.org/1999/xhtml」 xml:lang=」en」> 
<head> 
<title>Bohemia</title> 
</head> 
<body> 
<div style=」text-align:center」> 
<h1>Bohemia</h1> 
<h2>by Dorothy Parker</h2> 
</div> 
<p style=」text-align:left」> 
Authors and actors and artists and such<br /> 
Never know nothing, and never know much.<br /> 
Sculptors and singers and those of their kidney<br /> 
Tell their affairs from Seattle to Sydney. 
</p> 
<p style=」text-align:center」> 
Playwrights and poets and such horses’ necks<br /> 
Diarists, critics, and similar roe<br /> 
Never say nothing, and never say no. 
</p> 
<p style=」text-align:right」> 
People Who Do Things exceed my endurance;<br /> 
God, for a man that solicits insurance! 
</p> 
</body> 
</html> 

這裏(輸出)CSS定位標籤不工作。

回答

0

您使用的引號是錯誤的。嘗試使用「或」而不是:

<!DOCTYPE html> 
 
    <html> 
 
    <head> 
 
     <meta charset="utf-8"> 
 
     <meta name="viewport" content="width=device-width"> 
 
     <title>Bohemia</title> 
 
    </head> 
 
    <body> 
 
    <div style=」text-align:center」> 
 
    <h1>Bohemia</h1> 
 
    <h2>by Dorothy Parker</h2> 
 
    </div> 
 
    <p style='text-align:left'> 
 
    Authors and actors and artists and such 
 
    Never know nothing, and never know much. 
 
    Sculptors and singers and those of their kidney 
 
    Tell their affairs from Seattle to Sydney. 
 
    </p> 
 
    <p style='text-align:center'> 
 
    Playwrights and poets and such horses’ necks 
 
    Diarists, critics, and similar roe 
 
    Never say nothing, and never say no. 
 
    </p> 
 
    <p style='text-align:right'> 
 
    People Who Do Things exceed my endurance; 
 
    God, for a man that solicits insurance! 
 
    </p> 
 
    </body> 
 
    </html>

0

使用<div style='text-align:center'>,而不是這個

<div style=」text-align:center」>, 

如果我們使用<div style=」text-align:center」>這樣, 瀏覽器需要爲<div style="」text-align:center」"></div> 所以風格是考慮(「」)或('')不是這個(「)