发布网友
共3个回答
热心网友
1、首先创建一个新的html文件,如图所示。
2、在html文件上找到body标签,在这个标签里创建一个div标签并设置class类为bg ,如图所示。
3、接着在title标签后创建style标签用来给bg类添加样式。在这给bg类设置了一个宽、高和背景颜色。
4、然后设置鼠标滑过div时背景变色。给bg样式类添加鼠标滑过:hover,然后设置鼠标滑过时的背景颜色。
5、最后实用浏览器打开,保存好html后使用浏览器打开,在鼠标没有滑过div时背景是红色的,当鼠标滑过div的时候背景从红色变为了棕色。
热心网友
鼠标放在button上改变颜色,HTML
<button onmouseover="this.style.backgroundColor='red';"
热心网友
把下面代码直接保存为.html后缀名就可以了。。。记得给分就是了
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<style>
.adminbutton {border:#07A1EE 1px solid;background:#BFE7FA; height:22px;}
</style>
<body><br><br><br>
<center>
<input type="button" name="SubmitS" value=" 按 钮 " class="adminbutton" onMouseOut="this.style.backgroundColor=''" onMouseOver="this.style.backgroundColor='#efefef'" style="height:18px;padding-top:1px; width:">
</center>
</body>
</html>