CSS List Grid Layout 图片垂直居中

2022-04-15 0 1,087

<!doctype html public ‘-//w3c//dtd html 4.01//en’ ‘http://www.w3.org/tr/html4/strict.dtd’> <html> <head> <title>CSS List Grid View Layout</title> <style> body{ font-family:Arial; text-align:center; } p{ } .img-grid{ width:603px; margin:auto; overflow:hidden; position:relative; border:solid 20px #CCCCCC; } .img-grid h3{ padding:0 0 12px 0; background:#ccc; margin:0; font:normal normal bold 3em/normal “Georgia”; letter-spacing:-0.1em; text-align:center; } .img-grid ul{ list-style-type:none; margin:-1px 0 0 -1px; padding:0; width:100%; border-width:0px 1px 0 0; position:relative; } .img-grid li{ zoom:1; list-style-type:none; margin:0; padding:0; vertical-align:middle; width:200px; padding:0 0 30px 0; text-align:center; position:relative; border:solid 1px #dedede; border-top-color:#CCCCCC; margin:-1px -1px 0 0; border-width:1px 0 0px 1px; float:left; display:inline; font:150px/normal “Times new roman”; *padding:0; *font-size:180px; } .img-grid li img { vertical-align:middle; background:#fff; font-size:12px; padding:2px; border:solid 1px #555; } .img-grid li a:hover{ text-indent:0;/*IE6 need this to trigger :hover*/ } .img-grid li a:hover img{ padding:1px; border:solid 2px #336699; } .img-grid li strong{ display:block; font:small/1.1 Arial; background:#fff; position:absolute; bottom:0; left:0; width:100%; } .img-grid li strong a{ display:block; padding:8px 4px; color:#336699; text-decoration:none; zoom:1; } .img-grid li strong a:hover{ text-decoration:underline; } </style> </head> <body> <h1>CSS List Grid Layout</h1> <p>Compatible and tested with IE6, IE7, Safari 2, Safari 3, Firefox 2, Opera 9.21</p> <div class=”img-grid”> <h3>List Grid View</h3> <ul> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”20″ alt=”image” /></a> <strong><a href=”#”>sodales porta libero.n</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”40″ alt=”image” /></a> <strong><a href=”#”>sodales porterat. Nunc eu risus ut dolor bibendum adipiscing. Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”60″ alt=”image” /></a> <strong><a href=”#”>sodales porta libero. Integerdum adipiscing. Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”80″ alt=”image” /></a> <strong><a href=”#”>sodales porta libero. Integer adipiscing. Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”100″ alt=”image” /></a> <strong><a href=”#”>sodalesber Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”110″ alt=”image” /></a> <strong><a href=”#”>sodales in</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”20″ alt=”image” /></a> <strong><a href=”#”>sodales porta libero. Integer dignissim sceiquam erat. Nunc eu risus ut dolor bibendum adipiscing. Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”40″ alt=”image” /></a> <strong><a href=”#”>sodales porterat. Nunc eu risus ut dolor bibendum adipiscing. Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”60″ alt=”image” /></a> <strong><a href=”#”>sodales porta libero. Integer dignissim scelerisque massa.ndum adipiscing. Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”80″ alt=”image” /></a> <strong><a href=”#”>sodales porta libero. Integer dignissim at. Nunc eu risus ut dolor bibendum adipiscing. Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”100″ alt=”image” /></a> <strong><a href=”#”>sodales porta liber Proin</a></strong> </li> <li> <a href=”#”><img src=”http://farm1.static.flickr.com/182/424905397_d0ab1d8eea_m.jpg” height=”110″ alt=”image” /></a> <strong><a href=”#”>sodales porta liberor bibendum adipiscing. Proin</a></strong> </li> </ul> </div> </body> </html>

[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]

免责声明:
1、本网站所有发布的源码、软件和资料均为收集各大资源网站整理而来;仅限用于学习和研究目的,您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。 不得使用于非法商业用途,不得违反国家法律。否则后果自负!

2、本站信息来自网络,版权争议与本站无关。一切关于该资源商业行为与www.niceym.com无关。
如果您喜欢该程序,请支持正版源码、软件,购买注册,得到更好的正版服务。
如有侵犯你版权的,请邮件与我们联系处理(邮箱:skknet@qq.com),本站将立即改正。

NICE源码网 CSS/HTML CSS List Grid Layout 图片垂直居中 https://www.niceym.com/16962.html