我正在尝试运行包含css标签的html文件。但在输出中我只能看到html标签的输出而不是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 :(得分: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>
答案 1 :(得分:0)
使用<div style='text-align:center'>
代替此
<div style=”text-align:center”>,
如果我们像这样使用<div style=”text-align:center”>
,
浏览器视为<div style="”text-align:center”"></div>
所以样式被认为是一个字符串。使用(&#34;&#34;)或(&#39;&#39;)不是这一个(“)