Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 文档开头不允许使用XML_Javascript_Html_Css_Xml - Fatal编程技术网

Javascript 文档开头不允许使用XML

Javascript 文档开头不允许使用XML,javascript,html,css,xml,Javascript,Html,Css,Xml,我在这段代码中遇到以下错误: <style> #tt { position:absolute; display:block; background:url(images/tt_left.gif) top left no-repeat; } #tttop { display:block; height:5px; margin-left:5px; background:url(images/tt_top.gif) top right no-repeat; overfl

我在这段代码中遇到以下错误:

<style>
#tt {
 position:absolute;
 display:block;
 background:url(images/tt_left.gif) top left no-repeat;
 }
 #tttop {
 display:block;
 height:5px;
 margin-left:5px;
 background:url(images/tt_top.gif) top right no-repeat;
 overflow:hidden;
 }
 #ttcont {
 display:block;
 padding:2px 12px 3px 7px;
 margin-left:5px;
 background:#666;
 color:#fff;
 }
#ttbot {
display:block;
height:5px;
margin-left:5px;
background:url(images/tt_bottom.gif) top right no-repeat;
overflow:hidden;
}
</style>

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

#tt{
位置:绝对位置;
显示:块;
背景:url(images/tt_left.gif)左上角不重复;
}
#tttop{
显示:块;
高度:5px;
左边距:5px;
背景:url(images/tt_top.gif)右上角不重复;
溢出:隐藏;
}
#ttcont{
显示:块;
填充:2x12px 3px 7px;
左边距:5px;
背景:#666;
颜色:#fff;
}
#ttbot{
显示:块;
高度:5px;
左边距:5px;
背景:url(images/tt_bottom.gif)右上角不重复;
溢出:隐藏;
}
有人知道我为什么会犯这个错误吗? 我应该在哪里粘贴样式?

XML声明

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

…如果包括在内,必须是文件中的第一件事。它出现在样式元素之后

也就是说,1.0版是默认版本,UTF-8是默认版本,no是默认版本。所以你可以完全忽略它

更重要的是,假设您正在编写XHTML并将其作为text/html提供,那么您应该按照

我应该在哪里粘贴样式


样式元素只能作为head元素的子元素出现在XHTML 1.0文档中。

您最好阅读一篇关于该主题的介绍,而不是试图从非常具体的问题中学习非常基本的内容。我感谢您的输入,你能澄清一下你之前的意思吗