Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

巧用firebug 对Discuz!进行样式调试

[复制链接]
evenzhou 发表于 2012-10-31 10:01:48 | 显示全部楼层 |阅读模式
本帖最后由 evenzhou 于 2012-10-31 10:17 编辑

Discuz! 样式文件介绍
       首先,我们来认识下Discuz!的样式存放的规律。  样式文件存放在 tempate/default/common目录下common.css是共用的样式文件,几乎每个页面都需要用到其中的样式, module.css 是每个模块中要用到样式文件,下面我们来查看module.css样式文件中的样式分类规律,module.css样式,中添加有详细的注释,通过注释将样式分类。如:
  1. /** misc::invite,group,forum::viewthread,portal::view,home::space **/
  2.         /* .usl -> 用于类似群组中邀请好友中的好友列表 by Pony */
  3.                 .usl { overflow: scroll; overflow-x: hidden; padding: 5px; width: 580px; height: 280px; }
  4.                 .usl2 { width: auto; border: dashed {WRAPBORDERCOLOR}; border-width: 0 1px 1px; }
  5.                         .usl li { overflow: hidden; float: left; margin: 3px; width: 134px; height: 64px; }
  6.                         .usl a { display: block; padding: 4px; border: 1px solid {WRAPBG}; }
  7.                                 .usl a:hover { text-decoration: none; border: 1px solid; border-color: #DDD #999 #999 #DDD; background: {COMMONBG}; }
  8.                         .usl .avt { float: left; margin-right: 5px; width: 52px; height: 52px; border: 1px solid {COMMONBORDER}; background-color: {WRAPBG}; background-position: 2px 2px; background-repeat: no-repeat; zoom: 1; }
  9.                         .usl .d { float: left; width: 65px; height: 54px; overflow: hidden; word-wrap: break-word; }
  10.                         .usl li.a a, .usl li.a a:hover { border-color: #F90; background-color: #FFF1E1; }
  11.                         .usl li.a .avt span { display: block; margin-left: 2px; width: 50px; height: 50px; background: url({IMGDIR}/mark.png) no-repeat left bottom; }
  12.                 .usd { padding: 5px 10px 0; border: solid {WRAPBORDERCOLOR}; border-width: 1px 0; background-color: {COMMONBG}; }
  13.                 .usd2 { border-width: 1px; border-style: dashed; }
  14.                         .usd li { float: left; margin-right: 1%; width: 48%; }
  15. /** end **/
复制代码

仔细查看,注释开始处 /** misc::invite,group,forum::viewthread,portal::view,home::space **/, 这表示这些样式将邀请、群组、帖子内容页、文章内容页、个人空间中通过。Discuz! 的使用样式不是直接使用的template/default/common下的样式文件,而是读取的缓存文件(通过将样式文件进行解析),在这里不对样式解析函数进行介绍,有兴趣的可以阅读 source/function/cache/cache_style.php 中的代码。 解析之后的样式文件是存在在 data/cache目录下。


firebug 与 Discuz! 相结合
      现在,我们来了解firebug 中样式的特征,




      当将鼠标放在样式的加载路径上会弹出样式的详细地址,从第二张图中我们能够得到结论,这里的样式是来自于common/common.css目录, 从第一张图中我们能够得知 样式是来自于 module.css 中并且 在分类的时候应该有forum::viewthread  
      先在firebug的样式框中,对样式进行调试  满足要之后
我们到 template/default/common 目录下找到中firebug样式得知的样式文件 ,搜索关键字,更改完样式文件之后。最后 ,到后台更新一次缓存

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x

评分

1

查看全部评分

m.king 发表于 2012-10-31 10:02:38 | 显示全部楼层
哇   好厉害啊!!!!!!!!!
回复

使用道具 举报

。See_you_tomor 发表于 2012-10-31 10:04:11 | 显示全部楼层
沙发没了···

配合一下沙发,啊!好崇拜你啊
回复

使用道具 举报

liqu12511 发表于 2012-10-31 10:20:41 | 显示全部楼层
这个功能很强悍啊
回复

使用道具 举报

李渠 发表于 2012-10-31 10:21:36 | 显示全部楼层
提示: 该帖被管理员或版主屏蔽
回复

使用道具 举报

中国移动我不动 发表于 2012-10-31 10:41:09 | 显示全部楼层
我觉得用谷歌浏览器的查看元素,更直接方便
回复

使用道具 举报

abcnic18 发表于 2012-10-31 10:48:56 | 显示全部楼层
看看呢 怎么弄呢
回复

使用道具 举报

GGGHHH 发表于 2012-10-31 11:05:16 | 显示全部楼层
学习一下
回复

使用道具 举报

1314学习网 发表于 2012-10-31 12:25:43 | 显示全部楼层
不错,支持下
回复

使用道具 举报

腐朽的木头 发表于 2012-10-31 12:34:40 | 显示全部楼层
这个必须学习下{:soso_e113:}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-4-20 17:02 , Processed in 0.872169 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表