易截截图软件、单文件、免安装、纯绿色、仅160KB

CSS处理div中对象垂直对齐

CSS设置
<style type="text/css">
.box {
border:#eee solid 1px;
width:300px;
height:120px;
line-height:120px;
display:table-cell;
vertical-align:middle;
text-align:center;
}
</style>
1.文本
<div class="box">Sample text</div>
Sample text
2.图片(IE下在图片后面加一个空格)
<div class="box"><img alt="" src="http://www.csdn.net/images/newcsdnlogo.gif" /> </div>


相关文档:

CSS Border


首先要说的是元素的border,元素的边框 (border) 是围绕元素内容和内边距的一条或多条线。CSS border 属性允许你规定元素边框的样式、宽度和颜色。
CSS 边框
在 HTML 中,我们使用表格来创建文本周围的边框,但是通过使用 CSS 边框属性,我们可以创建出效果出色的边框,并且可以应用于任何元素。
元素外边距内就是元素 ......

IE7 CSS trouble

When you meet trouble with css style in IE7, try this. You can set different css for IE7 and the other browsers.
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="/home_c_ie7.css" mce_href="home_c_ie7.css" />
<![endif]-->
......

CSS默认重设

body{ background:#FFFFFF; font-size:12px; font-family:‘宋体’, Arial, Helvetica, sans-serif;}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,p,blockquote,table,th,td,
img{margin:0;padding:0;}
.partA,.partB,.partC,.partD,.partE,.partF,.partG,.partH,.partI,. ......

CSS之工作黏贴

/* Cascading Style Sheet for IE4.01 last updated 10-16-97 */
DIV {COLOR: #333333; FONT-FAMILY: "宋体", "Arial", "Tahoma"; FONT-SIZE: 9pt}
P {COLOR: #333333; FONT-FAMILY: "宋体", "Arial", "Tahoma"; FONT-SIZE: 9pt}
TD {COLOR: #333333; FONT-FAMILY: "宋体", "Arial", "Tahoma"; FONT-SIZE: 9pt}
BODY {C ......

几个经典的css技巧

使用 line-height 垂直居中
line-height:24px;
使用固定宽度的容器并且需要一行垂直居中时,使用 line-height 即可(高度与父层容器一致),更多的垂直居中总结可以看这里。
清除容器浮动
#main {
overflow:hidden;
}
不让链接折行
a {
white-space:nowrap;
}
上面的设定就能避免链接折行,不过个 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号