开发者

CSS formating is giving me an error when I try to validate the file

Line 8, Column 7: end tag for "STYLE" omitted, but its declaration does not permit this ✉ •You forgot to close a tag, or •you used something inside this tag that was not allowed, and the validator is complaining that the tag should be closed before such content can be allowed. The next message, "start tag was here" points to the particular instance of the tag in question); the positional indicator points to where the validator expected you to close the tag. Line 7, Column 1: start tag was here

<html>
<head>
<title>Randy's first html web page !</title>
<style type="text/css">
</head>
body
h1
{
background-color:#6495aa;
margin-right:1350px;
}
h2
{
background-color:#b0c4de;
margin-right:1350px;
}
p
{
background-color:#649fff;
margin-right:1350px;
}
div
{
background-color:#efffff;
}
</style>开发者_开发知识库


You closed your head before your style, so the validator sees it as you've already finished with <style>, and take it that you forgot to close it before </head>, try:

    <html>
<head>
<title>Randy's first html web page !</title>
<style type="text/css">
body
h1
{
background-color:#6495aa;
margin-right:1350px;
}
h2
{
background-color:#b0c4de;
margin-right:1350px;
}
p
{
background-color:#649fff;
margin-right:1350px;
}
div
{
background-color:#efffff;
}
</style>
</head>

also, I saw

body
h1
{
...

Is that intended?


You closed your <head> tag too early. Also, if you're trying to validate your file as XHTML, you may need to wrap your inline styles in a CDATA tag like so:

<style type="text/css">
<![CDATA[
/* CSS goes here */
]]>
</style>

Source of the XHTML tip

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜