Css div背景色不为';行不通
我一直在用html和css编写一个网站,最近我需要一个带有背景色的div元素。我在Css div背景色不为';行不通,css,html,Css,Html,我一直在用html和css编写一个网站,最近我需要一个带有背景色的div元素。我在中加入背景色:灰色,但这不起作用。我使用了Google Chrome的inspect元素功能,它说Chrome无法识别该元素。我在Firefox中使用了相同的功能,但它也无法识别css元素。div包含三个浮动部分,但是它使用了溢出:auto,所以这不是问题所在。有人能给我解释一下为什么我不能给我的div添加背景色吗 html: 在CSS的这一部分: #主{ 背景:灰色; 图层背景:灰色; /* .. */ } b
中加入背景色:灰色代码>,但这不起作用。我使用了Google Chrome的inspect元素功能,它说Chrome无法识别该元素。我在Firefox中使用了相同的功能,但它也无法识别css元素。div包含三个浮动部分,但是它使用了溢出:auto
,所以这不是问题所在。有人能给我解释一下为什么我不能给我的div添加背景色吗
html:
在CSS的这一部分:
#主{
背景:灰色;
图层背景:灰色;
/* .. */
}
backgound
应该是background
,而layer background
不是CSS属性
修复了这些错误后,.在CSS的这一部分:
#主{
背景:灰色;
图层背景:灰色;
/* .. */
}
backgound
应该是background
,而layer background
不是CSS属性
这些错误修复后,.背景的拼写不正确。正确的拼写是背景,请尝试使用十六进制代码而不是颜色名称。背景拼写不正确。正确的拼写是background,尝试使用十六进制代码而不是颜色名称。请发布元素的HTML和CSS(带选择器)。请发布元素的HTML和CSS(带选择器)。啊,你说得对。我很惭愧。每次我都会被打字错误弄糊涂<“代码>图层背景”
是我在互联网上找到的一种可以修复它的东西。打字错误有时会发生。会帮你找到它的。@PurpleMonkey会更具颜色特异性,因为它的范围更广。但我认为你使用的是个人偏好的问题。啊,你说得对。我很惭愧。每次我都会被打字错误弄糊涂<“代码>图层背景”是我在互联网上找到的一种可以修复它的东西。打字错误有时会发生。会帮你找到它的。@PurpleMonkey会更具颜色特异性,因为它的范围更广。但我认为你使用的是个人偏好的问题。
<div id="main">
<header>
<h1>LOGO</h1>
<nav>
<a href="index.html" title="Home">Home</a>
<a href="about.html" title="About">About</a>
<a href="features.html" title="Features">Features</a>
<a href="specs.html" title="Specifications">Specs</a>
<a href="updates.html" title="Updates">Updates</a>
<a href="contact.html" title="Contact Us">Contact</a>
</nav>
</header>
<section class="left">
<h2>NEWS</h2>
<p>Itate eaquid quodit, utem dolorenihit ullore ides est faccum simaiorrum accaerf erfercim voloremod ut volectem con cus, temoluptatur as disquatent.</p>
</section>
<section class="right">
<h2>SOMETHING</h2>
<p>Itate eaquid quodit, utem dolorenihit ullore ides est faccum simaiorrum accaerf erfercim voloremod ut volectem con cus, temoluptatur as disquatent.</p>
</section>
<section class="right">
<h2>SOMETHING</h2>
<p>Itate eaquid quodit, utem dolorenihit ullore ides est faccum
simaiorrum accaerf erfercim voloremod ut volectem con cus,
temoluptatur as disquatent.</p>
</section>
</div>
#main {
backgound: gray;
layer-background: gray;
overflow: auto;
border: 2px dashed black;
border-radius: 15px;
-moz-border-radius: 15px;
}
section {
background-color: green;
text-align: justify;
margin: 5px;
padding 10px;
border-radius: 10px;
-moz-border-radius: 10px;
}