dedecms怎么修改css


本文摘自PHP中文网,作者anonymity,侵删。

织梦DedeCMS修改模板默认CSS文件分析:首先,打开后台――模板――默认模板管理――index.htm.

看到有一句,<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 找打相关的定义。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

/*---------- 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的详细内容,更多文章请关注木庄网络博客

相关阅读 >>

css flex-shrink属性怎么用

css如何把背景旋转

css的属性分为什么类别

css选择器的分类有哪些

css怎么设置第一个子元素的高度

css如何取消样式

css超出部分如何设置省略号

css的display属性有哪些

css背景图片怎么自适应

css中div的意思是什么

更多相关阅读请进入《css》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...