css display和vertical-align 属性

display                                                                                                                    

定义和用法

display 属性规定元素应该生成的框的类型。

 1 <html>
 2 <head>
 3 <style type="text/css">
 4 p {display: inline}
 5 div {display: none}
 6 </style>
 7 </head>
 8 
 9 <body>
10 <p>本例中的样式表把段落元素设置为内联元素。</p>
11 
12 <p>而 div 元素不会显示出来!</p>
13 
14 <div>div 元素的内容不会显示出来!</div>
15 </body>
16 </html>
实例

vertical-align                                                                                                                     

定义和用法

vertical-align 属性设置元素的垂直对齐方式。

 1 <html>
 2 
 3 <head>
 4 <style type="text/css">
 5 img.top {vertical-align:text-top}
 6 img.bottom {vertical-align:text-bottom}
 7 </style>
 8 </head>
 9 
10 <body>
11 
12 <p>
13 这是一幅<img class="top" border="0" src="/i/eg_cute.gif" />位于段落中的图像。
14 </p> 
15 
16 <p>
17 这是一幅<img class="bottom" border="0" src="/i/eg_cute.gif" />位于段落中的图像。
18 </p>
19 
20 </body>
21 
22 </html>
实例

猜你喜欢

转载自www.cnblogs.com/kujiawei/p/10207647.html