2012-05-24 74 views
-2

这段代码将被加载到我正在浏览的网站的不同页面上的iframe中。但是,应该更改页面背景的CSS不起作用。即使当我加载这个(如不在iframe中),它有一个白色背景。是什么赋予了?有任何想法吗?为什么我的iframe的背景颜色不变?

<!--Developed, Written, and Implemented by Henry Edward Quinn IV in May of 2012 for the a Company--> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 

<head> 
<title>More Text about Equipment</title> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<style> 
<!--This little bit of CSS styling is just to guarantee consistency.--> 
body {background-color:#ebf0f3; 
    font-family:Arial, Helvetica, sans-serif; } 
</style> 
</head> 

<body> 
<!--This page will be loaded into an iframe. Only what's in the body will be visible on whatever page this will ultimately be on. 
Since we're just filling a text box, keep the content limited to a handful of <p> tags in order for things to stay simple.--> 
<a href="PATH/equipment.txt" target="_parent">More Information</a> 
<p> 
We've got some equipment here that has such and such a purpose and is extremely useful in certain situations (like A, B, and C). 
</p> 
</body> 

</html> 

回答

-2

我相信这是因为你有你的标签内的HTML注释。如果你删除了评论,它应该工作。或者使用

/*这一点CSS样式只是为了保证一致性* /。

+2

答案已经提前15分钟:) – Sarfraz

+0

特洛伊的回答说评论本身就是问题。我彻底摆脱了评论,背景颜色终于改变了。多谢你们! –

7

<!-- comment -->不是CSS有效的,你必须:

<!--This little bit of CSS styling is just to guarantee consistency.--> 

使用/* your comment */代替:

<style> 
/*This little bit of CSS styling is just to guarantee consistency.*/ 
body { 
     background-color:#ebf0f3; 
     font-family:Arial, Helvetica, sans-serif; 
    } 
</style>