看到有一句,<link href="{dede:global.cfg_templeturl/}/style/dedecms.css" rel="stylesheet" media="screen" type="text/css" />申明,我们模板是依据这个CSS来规划网页的,因而我们就翻开网站目次下面的templets\style\dedecms.css.然厥后剖析一下CSS的组成。
我们依据主页的挪用,来研讨CSS如许轻易明白。我们翻开主页模板,找到:
<div class="w960 center clear mt1">/*这句是掌握除了网站头部和友情链接的一切构造款式*/
那末 w960 center clear mt1 都定义了什么呢?我们翻开DEDECMS.CSS 找打相干的定义。
/*---------- stock ---------*/ .center{ margin:0px auto; 定义了CSS模块的边沿位置都是0,也就是这个center的层 间隔上右下左都是0px; } .w960{ width:960px; 定义了团体的宽度为960px; /*position:relative;*/ } .pright .infos_userinfo { margin-bottom: 0px; 定义了首页右手下的 互动中间的下面边沿为0px; } .mt1{/* ( margin-top * 1 ) */ margin-top:8px; 定义了mt1的顶部边沿为8px; } .pright .mt1{ margin-top:0px; 定义了pright 下面的mt1顶部边沿为0px; } .mt2{/* ( margin-top * 2 ) */ margin-top:16px; 顶部边沿为16px; } .clear{ overflow:hidden; 假如clear层内里的内容超越了 层的局限 就隐蔽起来。 } <div class="pleft">这个pleft 的定义 没有在dedecms.css 中,然则我们会发明一句话 @import url("layout.css"); @import url("page.css"); 这申明,在dedecms.css 中引用了 page.css 和layout.css 这两个款式表,因而我们就在page.css 中找到了pleft 的定义 .pleft{ width:712px;定义了宽度 float:left;该层向左浮动 overflow:hidden;超越局限则隐蔽 } <div class="bignews"> 在该层下面挪用的是消息头条的内容,看看它的css .index .bignews{ width:424px; height:400px; float:right; 向右浮动 border:1px solid #DFF2F5;示意边框线用 #dff2f5的实体色彩添补 background:url(../images/headbg-top.gif) repeat-x;背景图片为 headbg-top.gif 而且横向平铺 overflow:hidden;超越则隐蔽。 } 所以,我们看到头条的这部份是在flash幻灯片右侧显现,而且加上了浅蓝色的边框线。 <!--头条--> <div class="onenews"> 再来看看 onenews是怎样定义的。 .index .bignews .onenews{ margin:0 3px 0 3px; 摆布外边距离别空3个像素 padding:7px 6px;上左内边距离别空7,6个像素 border-bottom:1px dashed #EBEBEB;下边框加一个 #ebebeb的虚线 } 所以我们瞥见头条的文章摆布都有肯定的间隔,而且下面另有一个虚线显现 </div> <!-- /onenews --> 这个下面挪用的是以往的头条,默许的有4篇文章,挪用了d1 d1arc 2个css .index .bignews div.d1{ padding:6px 10px; clear:both;这句话是消灭浮动,假如不加它,人人能够碰运气,是否是 d1 这个层就跑到 头条的右侧了。 width:406px; overflow:hidden; } .index .bignews div.d1arc{ margin-right:12px; width:190px; float:left;由于此时要挪用4篇文章,改文章是2*2分列的,假如不加这个属性,消息就应该垂直分列了(由于你适才用clear:both 消灭浮动啦),人人碰运气是否是如许的。 height:24px; line-height:24px;行间距,即字体最底端与字体内部顶端之间的间隔 overflow:hidden; } <!--/头条--> <div class='newarticle'>最新文章</div> 下面看看 newarticle 这个css吧,照样拿快学网的首页举例子,上面的这句是用来显现 “近来更新”那几个绿色彩字的,看看它是怎样定义的。 .index .bignews div.newarticle{ height:24px; 高度 background:url(../images/new-article.gif) 8px 3px no-repeat;背景图片在x轴8px 和y轴3px出涌现 font-size:0px; color:#fff; } 所以,我们能看到谁人 近来更新 而且另有一个横条,实在它是个图片,人人右键图片另存为看看就知道了 <ul class="c2 ico1"> 这内里挪用了 c2 和ico1 两个 css .index .bignews ul.c2{ width:416px; padding:0px 4px 0px; 内边距为 上0 右4下0 clear:both;消灭浮动 和上面的意义一样 overflow:hidden; } ico1 这个css 在layout.css 中了。 .ico1 li{ padding-left:16px; 指的是 消息列表左内边距为16px background:url(../images/ico-1.gif) 7px 11px no-repeat; 背景在7px,11px 处涌现,所以我们看到最新文章的列表左侧都有一个小黑点,这个小黑点就是 ico-1.gif } </ul> </div> <!-- /bignews --> 到此,中部的头条消息和近来更新已剖析完了。 <div class="flashnews"> 看看flash的 css 定义 .index .flashnews{ width:280px; height:192px; overflow:hidden; float:left;这句决议了,flash 的消息列表在 头条的左侧显现。假如你把bignews 和flashnews 的float 属性交换一下应该是上面效果呢?人人碰运气。 } </div> <!-- /flashnews --> <div class="latestnews">这边是迥殊引荐挪用的款式,照样来看看css .index .latestnews{ width:280px; height:200px; margin-top:8px; float:left; } .index .latestnews dl dd{ padding:2px 5px; } .index .latestnews ul a{ color:#555; }
以上就是dedecms怎样修正css的细致内容,更多请关注ki4网别的相干文章!