首頁| 新聞| 娛樂| 游戲| 科普| 文學| 編程| 系統| 數據庫| 建站| 學院| 產品| 網管| 維修| 辦公| 熱點
例子1
不確定高度垂直居中
/* center < */ .vetically { vertical-align: middle; display: table-cell; *position: relative; } .vetically_C { display: block; margin: 0 auto; text-align: center; *position: absolute; *top: 50%; *left: 50%; *margin-top: expression(-(this.height ) / 2); *margin-left: expression(-(this.width ) / 2); } /* center > */
例子2
標準瀏覽器的情況還是和上面一樣,不同的是針對IE6/IE7利用在img標簽的前面插入一對空標簽的辦法。
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>方法2 - 未知高度的圖片垂直居中</title> <style type="text/css"> body { height:100%; } #box{ width:500px;height:400px; display:table-cell; text-align:center; vertical-align:middle; border:1px solid #d3d3d3;background:#fff; } #box img{ border:1px solid #ccc; } </style> <!--[if IE]> <style type="text/css">? #box i { display:inline-block; height:100%; vertical-align:middle } #box img { vertical-align:middle } </style> <![endif]--> </head> <body> <div id="box"> <i></i><img src="images/demo_zl.png" alt="" /> </div> </body> </html>
練就火眼金睛 十一種常見電腦
打印機共享提示“操作無法完成
如何查找有故障的配件
回眸一笑百魅生,六宮粉黛無顏色
歲月靜美,剪一影煙雨江南
蕪湖有個“松鼠小鎮”
小滿:小得盈滿,一切剛剛好!
一串串晶瑩剔透的葡萄,像一顆顆寶石掛在藤
正宗老北京脆皮烤鴨
人逢知己千杯少,喝酒搞笑圖集
搞笑試卷,學生惡搞答題
新聞熱點
疑難解答
圖片精選
DIV+CSS通用樣式布局實例代碼
input file(input文件域)的美化
首屆世界CSS設計大賽結果揭曉
網友關注