1,HTML里面如何让这两个色块挨在一起

css: *{margin:0;padding:0}
html的几乎所有标签都默认自带有margin和padding属性,即两个div间和间默认情况下都是有间隙的,那么在样式设置里,加上*{margin:0,padding:0},就可以消除标签自带间隙值了,*表示所有标签。

HTML里面如何让这两个色块挨在一起

2,divcss 怎么做这个啊 原本4个块颜色不同单onmouseover的时候

你的意思是说随便把鼠标放到哪一个上面其他的颜色都变成一样的吗?<script type="text/javascript">function ba() /*var t=document.getElementById("item0"); var t1=document.getElementById("item1"); var t2=document.getElementById("item2"); var t3=document.getElementById("item3"); t.style.backgroundColor="#F00"; t1.style.backgroundColor="#F00"; t2.style.backgroundColor="#F00"; t3.style.backgroundColor="#F00";*/ for(var i=0; i<4; i++) var t=document.getElementById("item"+i); t.style.backgroundColor="#F00"; }}function down() /*var t=document.getElementById("item0"); var t1=document.getElementById("item1"); var t2=document.getElementById("item2"); var t3=document.getElementById("item3"); t.style.backgroundColor="#0F0"; t1.style.backgroundColor="#666"; t2.style.backgroundColor="#009"; t3.style.backgroundColor="#063";*/ for(var i=0; i<4; i++) var t=document.getElementById("item"+i); if(i==0) t.style.backgroundColor="#0F0"; } if(i==1) t.style.backgroundColor="#666"; } if(i==2) t.style.backgroundColor="#009"; } if(i==3) t.style.backgroundColor="#063"; } }}</script><body style="width:340px"><div style="width:330px"><div id="item0" style="width:100px;height:100px;background-color:#0F0;float:left;margin-right:10px;" onm ouseout="down()" onm ouseover="ba()"></div><div id="item1" style="width:100px;height:100px;background-color:#666;float:left;margin-right:10px;" onm ouseout="down()" onm ouseover="ba()"></div> <div id="item2" style="width:100px;height:100px;background-color:#009;float:left;margin-right:10px;" onm ouseout="down()" onm ouseover="ba()"></div></div><div style="width:330px"><div id="item3" style="width:100px;height:100px;background-color:#063;float:left;margin-top:10px;" onm ouseout="down()" onm ouseover="ba()"></div></div></body>
给个思路吧用js+css 用一个父层套住4个块,默认父层下面的几个块颜色都不同,当执行onmouseover时给这父层设置一个ClassName,而ClassName下的那个块颜色用css设置成相同的:默认:div a 各颜色不同css: div a.a1 div a.a2 ...html: <div id="div1"> <a class="a1">1</a> <a class="a2">2</a> <a class="a3">3</a> <a class="a4">4</a> </div>执行onmouseover后:css: div.hover ahtml: <div id="div1" class="hover"> <a class="a1">1</a> <a class="a2">2</a> <a class="a3">3</a> <a class="a4">4</a> </div>其他的内容就不写了 ^_^
<style type="text/css">.kuang#header#center.left #footer</style><body><!-- header start --><div class="kuang"><div id="header"></div><!-- header end --><!-- center start --><div id="center"> <div class="left"></div> <div class="right"></div> </div><!-- center end --><!-- footer start --><div id="footer"></div><!-- footer end --></div></body>

divcss 怎么做这个啊 原本4个块颜色不同单onmouseover的时候


文章TAG:html  怎么  重叠  色块  html怎么重叠色块  
下一篇