六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 95|回复: 0

实用CSS技巧(不断更新...)

[复制链接]

升级  7.33%

13

主题

13

主题

13

主题

秀才

Rank: 2

积分
61
 楼主| 发表于 2013-1-29 07:48:53 | 显示全部楼层 |阅读模式
使文本框内的文字居中:
style="text-align: center"
强制设置下拉列表框长度:
<select name="selectObj" title="selectObj" style="width:250px">
</select>
设置表格行当鼠标移入时变色,移出行时恢复:
<TR bgcolor="#ffffff"

onMouseOut="this.style.backgroundColor='#ffffff'">
使链接变成按钮:
<a href="javascript:dispDetail('${returnCard.tid}');" >查看详细</a>
设置表格的行高:
<tr height="10"></tr>或<td height="100"></td>
设置表格的单元格为过渡颜色:
<td style="FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#5AAFE2,endColorStr=#ffffff)"></td>
定义一个DIV,固定长和宽,并设置滚动,可把循环的数据在里边输出从而保证页面上某些元素的固定位置:
<div  id="layer" style=" width:90%;position:absolute; height:490px; z-index:1; left: 50px; top: 50px; overflow:auto" >
<c:foreach var="obj" items = "listValue">
....
</c:foreach>
</div>
<center>
<!--下边这三个按钮的位置是固定的-->
<input name="add" type="button" id="add" value="新增">
<input name="edit" type="button" id="edit" value="编辑">
<input name="del" type="button" id="del" value="删除">
</center>
用DIV模拟带图片的按钮效果,当鼠标移动到"按钮"上方时,"按钮"背景变色,移出时,"按钮"恢复原背景色
<div style= "border:1px   solid   #000000; width:60;height:25"  id="buttonAdd"  onMouseOut="this.style.backgroundColor='#ffffff'">
                    <img src="<%=request.getContextPath()%>/images/add.gif">新增
                    </div>
                    <div style= "border:1px   solid   #000000; width:60;height:25"  id="buttonEdit"  onMouseOut="this.style.backgroundColor='#ffffff'">
                    <img src="<%=request.getContextPath()%>/images/edit.gif">编辑
                    </div>
                    <div style= "border:1px   solid   #000000; width:60;height:25"  id="buttonSave"  onMouseOut="this.style.backgroundColor='#ffffff'">
                    <img src="<%=request.getContextPath()%>/images/save.gif">保存
                    </div>
                    <div style= "border:1px   solid   #000000; width:60;height:25"  id="buttonDel"  onMouseOut="this.style.backgroundColor='#ffffff'">
                    <img src="<%=request.getContextPath()%>/images/x.gif">删除
                    </div>

arrayScore[j].readOnly=1;//用JS设置页面文本框为只读状态
arrayScore[j].readOnly=0;;//用JS设置页面文本框为去掉只读状态,注意"readOnly"的大小写
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表