Home  >  Article  >  Web Front-end  >  How to modify css in dedecms

How to modify css in dedecms

anonymity
anonymityOriginal
2019-05-28 09:49:584647browse

Dreamweaver DedeCMS Modify Template Default CSS File Analysis: First, open the background-template-default template management-index.htm.

I saw a sentence, f3679e63a70547e69c3e6070c7baec77Explanation, our template is based on this CSS to layout the web page , so we open templets\style\dedecms.css under the website directory. Then let’s analyze the composition of CSS.

How to modify css in dedecms

We study CSS based on the calls on the homepage so that it is easy to understand. We open the homepage template and find:

6f857ae33c82d1502854105d3ec94bc9/*This sentence controls all structural styles except the website header and friendly links*/

So what is defined by w960 center clear mt1? We open DEDECMS.CSS and look for the relevant definitions.

/*---------- 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层里面的内容超出了 层的范围 就隐藏起来。
} 
    
         
这个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;超出范围则隐藏 }
在该层下面调用的是新闻头条的内容,看看它的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幻灯片右边显示,并且加上了浅蓝色的边框线。
再来看看 onenews是如何定义的。 .index .bignews .onenews{ margin:0 3px 0 3px; 左右外边距分别空3个像素 padding:7px 6px;上左内边距分别空7,6个像素 border-bottom:1px dashed #EBEBEB;下边框加一个 #ebebeb的虚线 } 所以我们看见头条的文章左右都有一定的距离,并且下面还有一个虚线显示
这个下面调用的是以往的头条,默认的有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; }
最新文章
下面看看 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; } 所以,我们能看到那个 最近更新 并且还有一个横条,其实它是个图片,大家右键图片另存为看看就知道了
    这里面调用了 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 }
到此,中部的头条新闻和最近更新已经分析完了。
看看flash的 css 定义 .index .flashnews{ width:280px; height:192px; overflow:hidden; float:left;这句决定了,flash 的新闻列表在 头条的左边显示。如果你把bignews 和flashnews 的float 属性互换一下应该是上面结果呢?大家试试看。 }
这边是特别推荐调用的样式,还是来看看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; }

The above is the detailed content of How to modify css in dedecms. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn