我有这个简单的html页面
<html>
<head>
<meta charset="UTF-8">
<title>AlgoStash</title>
<style>
html {
background: url("<?php echo base_url('assets/sea.jpg');?>" no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
<audio src="<?php echo base_url('assets/avinu.mp3');?>" autoplay></audio>
</body>
<!-- אבא שלנו, המלך שלנו -->
</html>
产生这个html
<html>
<head>
<meta charset="UTF-8">
<title>AlgoStash</title>
<style>
html {
background: url("http://algopesa.com/assets/sea.jpg" no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
<audio src="http://algopesa.com/assets/avinu.mp3" autoplay></audio>
</body>
<!-- אבא שלנו, המלך שלנו -->
</html>
但是,页面不显示图像。
为什么这段代码
html {
background: url("http://algopesa.com/assets/sea.jpg" no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
尽管图像存在,不会产生背景图像?如何显示图像?。
答案 0 :(得分:3)
您需要关闭url(... )
,否则无效:
<html>
<head>
<meta charset="UTF-8">
<title>AlgoStash</title>
<style>
html {
background: url("<?php echo base_url('assets/sea.jpg');?>") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
<audio src="<?php echo base_url('assets/avinu.mp3');?>" autoplay></audio>
</body>
<!-- אבא שלנו, המלך שלנו -->
</html>