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,层叠样式表的作用是什么?我们先通过一个例子来体会一下:
看代码:
index.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv=" ......
/*控制图片的大小*/
.contentimg{
max-width:600px;
/*max-height:100px;*/
}
*html.contentimg{
width:expression(this.width>50&&this.width>this.height?60:auto);
/*height:expresion(this.height>50?50:auto);
*/
}
调用
$("#"+id.substring(0,id.length-5)+"arCon"). ......
用float时发现margin不起作用,图片和文字并排时老是不能对齐,于是搜到了这篇文章。 -------------------------------------------------------------------------------------------------------------------- 原创文章,转载请注明来自张鑫旭-鑫空间-鑫生活[http://www.zhangxinxu.com] 本文地址:http://www.zhangxi ......
margin:层的边框以外留的空白
background-color:背景颜色
background-image:背景图片
padding:层的边框到层的内容之间的空白
border:边框
content:内容
步骤一、
分析一个典型的定义div例子:
#sample{
margin:10px;
border: #111 10px solid;
......