我想在我的网站中添加一个背景,我只是盯着教程,我的代码就像这样
<html xmlns="http:/www.w3.org/1999/xhtml">
<head>
<title>PARIS DROP OUT</title>
<link href="stylesheets/style.css" media="screen" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header1">
<h1>THE DROP OUTS</h1>
</div>
<div id="#container_div">
<img id="drop" src="img/SHOCK.jpg" />
<background-image: src="img/background" />
<p class="red">ESTA PAGINA ES DE LOS LOCOS</p>
<p> Nowadays it's easy to put together a web presence using social media and a personal landing page, but if you want to actually make your own web site you're going to need to learn HTML and CSS. Fortunately, we can help. </p>
</div>
</body>
我的CSS看起来像这样:
<code> #container_div {
width:1800px;
height: :1800px;
background:red;
我尝试将图像也不起作用 我有与教程中完全相同的代码,无论我改变什么,我都看不到背景
答案 0 :(得分:0)
你的div应该是<div id="container_div">
(注意:没有#)
CSS选择器#container_div
表示“id =”container_div“
享受!
答案 1 :(得分:0)
用于更改背景颜色的css代码
Background-color:red;
用于更改背景图片的css代码
Background-image:url();
你的css课程:
#container_div {
width:1800px;
height:1800px;
Background-color:red;
}