望高手指点span标签内插入img标签和文字的竖向对齐问题?
<div class="show_u_li_right">
<span><input type="text" class="userinfo_input"/></span>
<span class="userinfo_sp"><img src="img/form (1).gif"/>输入旧密码</span>
</div>
.userinfo_sp {
height: 22px;
width: auto;
float:left;
position:absolute;
padding-top: 2px;
padding-bottom: 2px;
}
.show_u_li_right {
float: left;
height: 26px;
width: 600px;
}
<span class="userinfo_sp"><img src="img/form (1).gif"/>输入旧密码</span>
该段span内设line-height:22px vertical-align:middlen “输入旧密码”不竖向居中
望高手解决....
[解决办法]
输入旧密码 要这几个字呈现成这样吗?输
入
旧
密
码
[解决办法]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title> New Document </title> <style> .userinfo_sp { height: 22px; width: auto; background:url(images/ico_tip.gif) left center no-repeat; padding-left:20px;} </style> </head> <body> <div class="show_u_li_right"> <span><input type="text" class="userinfo_input"/></span> <span class="userinfo_sp">输入旧密码</span></div> </body></html>
[解决办法]
<span class="userinfo_sp"><img src="img/form (1).gif"/>输入旧密码</span>
调整为:(由于span是行内元素,img是段元素,这样写不符合规范!!)
<img id="pic" src="img/form (1).gif"/>
<span id="text" class="userinfo_sp">输入旧密码</span>
<script>
document.getElementById("text").style.position="absolute";
document.getElementById("text").style.top=document.getElementById("text").style.top+document.getElementById("text").height/2+"px";
</script>
[解决办法]