如何让图标居中显示
如何让图标居中显示[img]http://www.discuz.net/attachments/month_0807/20080706_2a540a9516654e6b48eam9D6gqmZjfsr.jpg[/img]
[[i] 本帖最后由 jwj9952 于 2008-8-12 17:14 编辑 [/i]] [url]http://www.discuz.net/viewthread.php?tid=961001&page=9#pid7751130[/url] 没用过这个风格,给出代码看看!DIV随高度自动居中,不太好掌握! .todaynew { width:58px; height:55px; float:left; background:url({IMGDIR}/digg.gif) no-repeat center top; margin:5px;margin-left: -5px; text-align:center; color:#f60; font-weight:bold; font-size:12px; line-height:23px; font-family: Georgia, "Times New Roman", Times, serif; }
.todaynew p { display:block; font-weight:100; margin:0px; padding:0px; border:0px; color:#858D92;}
.today { width:58px; height:55px; float:left; background:url({IMGDIR}/digg_blue.gif) no-repeat center top; margin:5px;margin-left: -5px; text-align:center; color:#217AB3; font-weight:bold; font-size:12px; line-height:23px; font-family: Georgia, "Times New Roman", Times, serif; }
.today p { display:block; font-weight:100; margin:0px; padding:0px; border:0px; color:#858D92; font-size:11px; } 在.today和.todaynew 添加position:absolute; top:50%; margin: -50px 0 0 -5px;看看! 不行,在简介上方了,另外的版块此图标也不显示了
[img]http://www.3dportal.cn/discuz61/d6/attachments/month_0807/20080706_66ae17f15c33af98f3832MU2oFFHSsqY.jpg[/img] 去掉position:absolute;看看,还不行,我也没办法哦,DIV随高度自动居中,比较麻烦哦。 为何默认的可以?
默认的这段是:
.forumlist th { padding-left: 55px !important; }
.forumlist tbody th { background-image: url({IMGDIR}/forum.gif); background-repeat: no-repeat; background-position: 13px 50%; }
.forumlist tbody th.new { background-image: url({IMGDIR}/forum_new.gif); }
再有修改discuz.htm可以吗?
<!--{if $forum[todayposts] && !$forum['redirect']}--><div class="todaynew">$forum[todayposts]<p>{lang index_today}</p></div><!--{else}--><div class="today">0<p>{lang index_today}</p></div><!--{/if}-->
<h2><a href="forumdisplay.php?fid=$forum[fid]">$forum[name]</a></h2> 默认风格只定位了背景,当然可以,而你用的那个风格,添加了DIV来定位,当然比较麻烦哦,我目前不知道你那个风格的自动居中的解决方法。
页:
[1]
