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
相关文档:
1.css 字体简写规则
当使用css定义字体时你可能会这样做:
font-size: 1em;
line-height: 1.5em;
font-weight: bold;
font-style: italic;
font-variant: small-caps;
font-family: verdana,serif;
事实上你可以简写这些属性:
font: 1em/1.5em bold italic small-caps ver ......
什么情况下会出现换行:
当元素设置了固定高度,并且文本长度大于标签元素的宽度时,文本会自动换行。
css强制换行使用样式:white-space:nowrap;该样式从效果上是没有浏览器差异,使用该样式后所有文字在ie和firefox下都在一行内显示。但是在IE下使用该属性值后标签元素宽度会被撑大,从而可能导致原来页面布局被破坏。
......
来自: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 ......
About Box Model:
一个块级元素由content, padding, background, border, margin五个部分组成. 立体图1如下:
平面图如下:
根据以上两图, 相信大家对于Box model会有个直观的认识.
以下说明margin和padding属性:
1. Margin: 包括margin-top, margin-right, ma ......
用float时发现margin不起作用,图片和文字并排时老是不能对齐,于是搜到了这篇文章。 -------------------------------------------------------------------------------------------------------------------- 原创文章,转载请注明来自张鑫旭-鑫空间-鑫生活[http://www.zhangxinxu.com] 本文地址:http://www.zhangxi ......