给你个例子,用onmousemove和nmouseout。具体css颜色等自己改一下。
<style>
.input_out{width:60pxheight:30pxborder:1pxsolid#CCCbackground-color:#FFF}
.input_move{width:60pxheight:30pxborder:1pxsolid#CCCbackground-color:#FFFFCC}
</style><inputtype="button"class="input_out"onmousemove="this.className='input_move'"onmouseout="this.className='input_out'"value="提交"/>
涉及到input里的文字的标签大致有两种——文本框和按钮,即:
这两种input标签属于“行内块元素”,它既按照块元素显示外观,又按照行内元素排列,所以想调整其内部的文字位置可按照块元素的方法来。下面是示例(仅以button为例,text同理):
文字左右对齐,可使用text-align属性来控制,例如:
文字上下对齐,可使用padding-top和padding-bottom来精确控制,例如文字靠下。
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css">
.parent{
width: 300px
height: 100px
overflow: hidden
background: yellow
}
.parent>div{
width: 96px
height: 96px
border: 2px solid #000
float: left
}
.parent>div:hover{
border-color: red
}
</style>
</head>
<body>
<div class="parent">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
</body>
</html>
这样样子并不会盖住呀!