第1个回答 推荐于2016-10-27
给你2个解决方案:
1、
<div class="bg" onmouseover="this.className='bg_hover'" onmouseout="this.className='bg'"></div>
<style type="text/css">
.bg{ background:red; width:100px; height:50px;}
.bg_hover{ background:black; width:100px; height:50px;}
</style>
2、
<div class="bg" ></div>
<style type="text/css">
.bg{ background:red; width:100px; height:50px;}
.bg:hover{ background:black; width:100px; height:50px;}
</style>本回答被提问者采纳