CSS脚本不能正常工作

问题描述:

我试图运行包含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定位标签不工作。

您使用的引号是错误的。尝试使用“或”而不是:

<!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>

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

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

如果我们使用<div style=”text-align:center”>这样, 浏览器需要为<div style="”text-align:center”"></div> 所以风格是考虑(“”)或('')不是这个(“)