怎么合并CSS文件啊?

html-css09

怎么合并CSS文件啊?,第1张

在一个CSS文件利用@import url('其他的CSS文件')

想引入几个CSS文件就用几个@import url

注意路径的的书写

首页需要两个CSS文件index.css和common.css

就在index.css的首行写入(两个CSS文件在同一个目录下)

@import url('common.css')

这样只需要在首页链接一个index.css文件就可以了。

使用纯css制作扇形图,合并起来形成饼图:

应该知道css3中引入了圆角属性(border-radius),一旦设置这个值,边框即会出现圆角。同样,我们对正方形设置圆角,即可得到饼状图

html:<div id="circle">11</div>

css:

#circle{

width:0

height:0

border-radius:100px

border-width:100px

border-style:solid

border-color: red blue green yellow

line-height:99em

overflow:hidden

cursor:pointer

margin: 30px auto

}

效果:

4.同样我们对其中三个边框设置透明色即可得到扇形

html:<div id="fan">11</div>

css:

#fan{

width:0

height:0

border-radius:100px

border-width:100px

border-style:solid

border-color:red transparent transparent transparent

line-height:99em

overflow:hidden

cursor:pointer

margin: 30px auto

}

效果:

当浏览器读到一个样式表,它就会按照这个样式表来对文档进行格式化。有以下三种方式来插入样式表:

1、外部样式表当样式需要被应用到很多页面的时候,外部样式表将是理想的选择。使用外部样式表,你就可以通过更改一个文件来改变整个站点的外观;

例如:

2、内部样式表当单个文件需要特别样式时,就可以使用内部样式表。你可以在

head

部分通过

标签定义内部样式表;

例如:<style

type="text/css">body

{background-color:

red}p

{margin-left:

20px}

3、内联样式当特殊的样式需要应用到个别元素时,就可以使用内联样式。使用内联样式的方法是在相关的标签中使用样式属性。样式属性可以包含任何

CSS

属性。以下实例显示出如何改变段落的颜色和左外边距。

例如:

This

is

a

paragraph