作家
登录

css客齐集社区头像显示效果

作者: 来源:www.28hudong.com 2013-03-30 03:04:11 阅读 我要评论

代码说明: 这段中,定义了一个大的块DIV; 并给了他一个ID; 下边分别有LI,A,SPAN,IMG四个标签; 这样我们就可以在CSS中设置这四个标签来实现我们想要的效果; <div id="zishu_test"> <ul> <li><a href="64d'>http://www.zishu.cn/blogview.asp?logID=553"><span>64d / 47 hits</span><img src="pixu/upload/20080607224454669.jpg">pixu</a></li> ........... 以下这段定义了网页的基本内容和链接的样式; body{ font-size:12px; line-height:1.8; font-family:Verdana, "宋体", Arial,Sans; text-align:center; background:#FFF; color:#666; margin:50px; padding:0; list-style:none; } a:link,a:visited{color:#000099; text-decoration: underline;} a:hover,a:active{color:#000;text-decoration: none;} 以下这行定义了列表横向显示,每个LI占14%的宽度;14%是由100%除以7块等于的; 而且LI里边的内容要居中显示; margin:0 auto; 这句是为了实现FIREFOX居中显示的; #zishu_test li{ float:left; width:14%;text-align:center; margin:0 auto; list-style:none } 以下这行统一定义了一下A标签;边框,宽度,背景等; 其实这时候已经有边框了,只不过和背景色一样;你看不到; 如果你把网页的背景色改一下; 你就会看到效果了; #zishu_test li a{border-right:1px solid #fff;border-bottom:1px solid #fff; width:100px; height:110px; background:#fff;display:block; padding-top:10px; margin:auto} 以下定义了图片,给图片边上加了留白效果;和边框效果; #zishu_test li img{ width:75px; height:75px; display:block; text-align:center; margin:auto; background:#FFF; padding:3px; border:1px solid #D8A18B;} 以下这行就是隐藏SPAN标签里的内容; #zishu_test li span{display:none;} 以下这行就是定义鼠标移上去的效果; 主要是显示SPAN里的内容; 和定义SPAN内容的位置; 注意;这样去定义SPAN的位置会在不同的浏览器中有不同的效果的;所以才有了后边那两行代码;另外注意的是;这里只定义了SPAN; #zishu_test li a:hover span{ margin-top:-10px;display:block; border-bottom:1px solid #666; border-right:1px solid #666; background:#FA9000; width:100px; color:#FFF; position:absolute; } 以下这两行是为了在不同浏览器中看到的效果一样而写的;主要是为IE6和IE7写的; 有人问为什么不把IMPORTANT写在上一行中? 你试一试再想一想就知道了; 我用这样的办法去改变IE6和IE7;我也不知道怎么样;因为我实在没有想到更好的办法; * html #zishu_test li a:hover span {margin-left:-8px; } /* IE6 */ *+html #zishu_test li a:hover span {margin-left:-8px; }/* IE7*/ 最后这行就简单了;只是改变边框的色,给人的感觉就是鼠标移上去有变化了; #zishu_test li a:hover{ border-right:1px solid #D8A18B;border-bottom:1px solid #D8A18B; width:100px; height:110px; background:#F5F5F5;display:block; padding-top:10px;} zishu.cn test body{ font-size:12px; line-height:1.8; font-family:Verdana, "宋体", Arial,Sans; text-align:center; background:#FFF; color:#666; margin:50px; padding:0; list-style:none; } a:link,a:visited{color:#000099; text-decoration: underline;} a:hover,a:active{color:#000;text-decoration: none;} #zishu_test li{ float:left; width:14%;text-align:center; margin:0 auto; list-style:none } #zishu_test li a{border-right:1px solid #fff;border-bottom:1px solid #fff; width:100px; height:110px; background:#fff;display:block; padding-top:10px; margin:auto} #zishu_test li img{ width:75px; height:75px; display:block; text-align:center; margin:auto; background:#FFF; padding:3px; border:1px solid #D8A18B;} #zishu_test li span{display:none;} #zishu_test li a:hover span{ margin-top:-10px;display:block; border-bottom:1px solid #666; border-right:1px solid #666; background:#FA9000; width:100px; color:#FFF; position:absolute; } * html #zishu_test li a:hover span {margin-left:-8px; } /* IE6 */ *+html #zishu_test li a:hover span {margin-left:-8px; }/* IE7*/ #zishu_test li a:hover{ border-right:1px solid #D8A18B;border-bottom:1px solid #D8A18B; width:100px; height:110px; background:#F5F5F5;display:block; padding-top:10px;} 64d / 47 hitspixu 24d / 35 hits秀才 66d / 87 hits透露 40d / 34 hitsLIVID 47d / 56 hits老孟 42d / 36hits小玉 63d / 67 hitspixu 源贴地址为http://www.zishu.cn/blogview.asp?logID=553 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]

  推荐阅读

  js循环输出图片,不足的要补0 原创

我想把001.gif~285.gif显示在网页上。JS如果实现? HTML 是这样写 <img src=001.gif> <img src=002.gif> ... <img src=010.gif> <img src=011.gif> ... <img src=285.gif> 解决方法: [Ctrl+A 全选 注:如需>>>详细阅读


本文标题:css客齐集社区头像显示效果

地址:http://www.17bianji.com/kaifa2/JS/29650.html

关键词: 探索发现

乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

网友点评
自媒体专栏

评论

热度

精彩导读
栏目ID=71的表不存在(操作类型=0)