[英]background-image:url not showing up image for background using css
我正在尝试使用background-image:url设置背景图像,但是它不起作用。
<!doctype html>
<html>
<head>
<title>MyTitle</title>
<style type="text/css">
body{
<!-- background-color:green; -->
background-image:url("background.jpg");
<!-- color:white; -->
}
</style>
</head>
<body>
</body>
</html>
请帮助!!
<!-- comment -->
在CSS块中不是有效的注释语法。 那可能违反了CSS规则。
尝试
/* comment */
标签不会嵌套在标签中。
尝试
<!doctype html>
<html>
<style type="text/css">
body{
/* background-color:green; */
background-image:url("background.jpg");
/* color:white; */
}
</style>
<head>
<title>MyTitle</title>
</head>
<body>
</body>
</html>
CSS中的注释定义如下:
/*this is a comment*/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.