常用css

1:input与img对齐
<style>
alignImg{
vertical-align:middle;
}
</style>
<table>
<tr>
<td>
<input class="classA alignImg"/>
<img class="alignImg"/>
</td>
</tr>
</table>
input使用了两个class名.

2:防止单元内容太大把table撑变型
td{
word-break: break-all;
color:red !important;
}
3:验证input的长度时最好使用maxlength属性,而不是js.
<input name="username" maxlength="100"/>
数据库中定义的字段长度是varchar2(200),这样是因为在GBK中文环境时页面的100个字符,存到数据库中正好是200。如果页面输入200个英文是可以保存成功的,但是不能保证用户只输入英文。
4:css控制超链接的样式
a:link {color:blue; text-decoration:none;}
a:visited {color:red; text-decoration:none;}
a:hover {color:red; text-decoration:underline;}
a:active {color red; text-decoration:none;}

5:使div中的内容可以在浏览器中编辑
<div contentEditable="true" unselectable="off" ></div>
然后使用js得到元素的css位置值,可以把这些值保存在服务器中
var v_top = obj.style.top;
var v_left = obj.style.left;
var v_width = obj.style.width;
var v_height = obj.style.height;


6:IE本地显示图片
<style type="text/css">
#_show{
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
#_man1{
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}
#man2{
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
}

</style>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值