DIV css 相对父容器 水平、垂直 居中
终于把它写出来了。哈哈
<div style="width:100%;height:100%;position:relative;overflow:hidden;"
><br style="line-height:0;"
/><div style="position:relative;top:50%;left:50%;"><br style="line-height:0;"
/><div style="position:relative;
background-color:Yellow;
height:200px;width:200px;
margin-top:-100px;margin-left:-100px;overflow:auto;"
><br style="line-height:0;"
/><div>
名称:<asp:TextBox runat="server" ID="name"></asp:TextBox>
</div>
<br />
<div>
显示名:<asp:TextBox runat="server" ID="TextBox1"></asp:TextBox>
</div>
</div>
</div>
</div>
前3层DIV是必须的。
如果是IE可以去掉第一层DIV.
下面4个数据:
height:200px;width:200px;
margin-top:-100px;margin-left:-100px;"
必须人工计算。
--以后有时间再写完全自动的布局的css
相关文档:
来自:http://www.51xflash.com/website/html/200905/01-8904.html
CSS代码: (插入到CSS文件的最顶端)
html { filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1); }
或者:
*{filter: Gray;}
HTML代码: (插入到页面HTML源码的<HEAD>和</HEAD>之间)
<style>html{filter:progid:DXIm ......
在网页里使用table的时候,样式一般比较难管理,因为table的有些样式与其它控件不太一样
1、table的分外边框,tr边框,td边框,它们之间都是有间距的
2、你可以指定它们之间的间距为0,但当你设置边框时,会发现边框是2px宽的,因为在table里,tr、td等元素是相邻的
所以想做一个好看的table样式可以参考以下的步骤:
1 ......
逐渐喜欢上padding 虽然它并不完美,任何事物都有两面性,无所谓对错,关键是要用对地方!
padding 和 margin相比较,padding 可以将div 等撑起来占用实际空间,而margin则比较小心。
但是就是padding这点缺帮我解决了一个input 和 submit的对齐问题。 ......