Maison interface Web tutoriel CSS 第四章 颜色背景的CSS

第四章 颜色背景的CSS

Dec 19, 2016 pm 04:06 PM
css

本 章 C S S 的 主 要 作 用

   

  在前面的章节介绍完了声明与应用的方法及 一些特性之後,从这章开始,便要正式进入CSS的指令介绍了!本章有两个介绍的主 题,第一个部份介绍的是颜色与背景性质的CSS,其主要的作用在于设定元素的前景 颜色、背景颜色与背景图形等样式设定的性质;而第二部份为您介绍的是用于控制摆放 元素位置的CSS的指令。    

颜 色 背 景 的 C S S 指 令

   

color 设定前景颜色支 持:IE3、IE4、NC4适 用:所有元素可能值:<color>设定颜色,请参考第一章颜色使用的相关说明预设值:视浏览器而定继承性:有一般范例:SPAN { color : BLUE }同轴范例:<SPAN style="color:BLUE">background-color 设定背景颜色支 持:IE4、NC4适 用:所有元素可能值:<color>设定颜色,请参考第一章颜色使用的相关说明transparent将父元素(颜色或图案)的背景透明化预设值:transparent继承性:无一般范例:BODY { background-color : BLUE }同轴范例:<BODY style="background-color:BLUE">background-image 设定背景图形支 持:IE4、NC4适 用:所有元素可能值:<url>设定图档URL,请参考第一章URL表示的相关说明none不使用背景图案预设值:transparent继承性:无一般范例:BODY { background-image : URL("http://yourweb/path/file_name") }同轴范例:<BODY style="background-image:URL('http://yourweb/path/file_name')">background-repeat 设定背景重复支 持:IE4、NC4适 用:所有元素可能值:repeat重复背景图形填满页面repeat-x水平方向重复背景图形repeat-y垂直方向重复背景图形no-repeat不重复显示背景图形预设值:repeat继承性:无一般范例:BODY { background-repeat : repeat-x }同轴范例:<BODY style="background-repeat: repeat-x">background-attachment 设定背景附著支 持:IE4、NC4适 用:所有元素可能值:scroll背景图形随著卷轴卷动fixed背景图形随著卷轴卷动(浮水印)预设值:scrool继承性:无一般范例:BODY { background-attachment : fixed }同轴范例:<BODY style="background-attachment:fixed">background-position 设定背景位置支 持:IE4、NC4适 用:区块元素 可能值:<percent> X% Y%图形上X% Y%的点对准元素的X% Y%位置<length> X Y将图形左上角置于元素左上角水平 X垂直 Y之处center背景图形置于中央left背景图形对 左边right背景图形对 右边top背景图形对 顶部bottom背景图形对 底部预设值:0% 0%继承性:无一般范例:BODY { background- position : 100% 50% }同轴范例:<BODY style="background- position:100% 50%">background 综合设定背景性质支 持:IE3、IE4、NC4适 用:所有元素 可能值:background-color设定背景颜色background-image设定背景图形background-repeat设定背景重复background-attachment设定背景附著background-position设定背景位置预设值:无继承性:无一般范例:BODY { BLUE url(image/gif) repeat-x fixed center }同轴范例:<BODY style="BLUE url(image/gif) repeat-x fixed center">     

位 置 摆 放 的 C S S 指 令

   

float 设定浮动性质(多用于文绕图的情形)支 持:IE4、NC4适 用:区块元素或图形可能值:left元素靠左,文字围绕其右right元素靠右,文字围绕其左none以预设的方法显示预设值:none继承性:无一般范例:DIV { float : right }同轴范例:<DIV style="float:right">clear 设定清除性质(设定是否允许浮动元素之存在)支 持:IE4适 用:区块元素或图形可能值:both若两边有浮动元素,则该元素移至浮动元素下方left若左边有浮动元素,则该元素移至浮动元素下方right若右边有浮动元素,则该元素移至浮动元素下方none以预设的方法显示预设值:none继承性:无一般范例:DIV { clear : right }同轴范例:<DIV style="clear:right">width 设定宽度支 持:IE4、NC4适 用:区块元素或图形可能值:<length>长度单位,请参考第一章基本单位的相关说明<percentage>百分比,以父元素宽度为基准auto以固定比例自动变化大小预设值:auto继承性:无一般范例:DIV { width : 300pt }同轴范例:<DIV style="width:300pt">height 设定高度支 持:IE4、NC4适 用:区块元素或图形可能值:<length>长度单位,请参考第一章基本单位的相关说明<percentage>百分比,以父元素宽度为基准auto以固定比例自动变化大小预设值:auto继承性:无一般范例:DIV { height : 300pt }同轴范例:<DIV style="height:300pt">position 设定位置支 持:IE4、NC4适 用:区块元素可能值:absolute以父元素为基准,摆设在特定位置上relative以相邻元素为基准,摆设在特定位置上static预设位置,以该元素于原始码中位置而定预设值:absolute继承性:无一般范例:DIV { position : static }同轴范例:<DIV style="position:static">top 设定顶端位置支 持:IE4、NC4适 用:区块元素可能值:<length>长度单位,请参考第一章基本单位的相关说明<percentage>百分比,以父元素宽度为基准auto以正常方式显示预设值:auto继承性:无一般范例:DIV { top : 30pt }同轴范例:<DIV style="top:30pt">left 设定左端位置支 持:IE4、NC4适 用:区块元素可能值:<length>长度单位,请参考第一章基本单位的相关说明<percentage>百分比,以父元素宽度为基准auto以正常方式显示预设值:auto继承性:无一般范例:DIV { left : 30pt }同轴范例:<DIV style="left:30pt">clip 设定裁剪(设定某区域形状及大小,区域外通透)支 持:IE4、NC4适 用:区块元素 可能值:rect(top,right,bottom,left)设定矩形之上右下左长度,会自动比对对边长度一般 写法为rect(0,长度,长度,0)不可以写为rect(0,0,长度,长度)四个数值皆可以"auto"代替auto以正常方式显示预设值:auto继承性:无一般范例:DIV { clip : rect(0,100px,50px,0) }同轴范例:<DIV style="clip:rect(0,100px,50px,0)">overflow 设定溢位处理(控制当元素内容超过该元素大小时的显示方式)支 持:IE4适 用:区块元素 可能值:visible元素将不会依所设订大小显示,而能看见所有内容hidden超过元素所设订大小之部份将被隐藏不予显示scroll如有必要出现卷轴可让使用者看到全部的内容auto以预设的方式显示预设值:auto继承性:无一般范例:DIV { overflow : scroll }同轴范例:<DIV style="overflow:scroll">visibility 设定可视度支 持:IE4、NC4适 用:所有元素可能值:visible设定该元素显示hidden设定该元素不显示,但仍占据空间inherit以父元素可视度决定预设值:inherit继承性:无一般范例:DIV { visibility : hidden }同轴范例:<DIV style="visibility:hidden">z-index 设定Z轴参数(三度空间)支 持:IE4、NC4适 用:区块元素可能值:<number>十进位数值,数值大的元素会出现在数值小的元素的上方auto当元素位置重复时,原始码中写在後面元素会出现在写在前面元素的上方预设值:auto继承性:无一般范例:DIV { z-index : 3 }同轴范例:<DIV style="z-index:3">    

 以上就是第四章 颜色背景的CSS的内容,更多相关内容请关注PHP中文网(www.php.cn)! 


Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn

Article chaud

R.E.P.O. Crystals d'énergie expliqués et ce qu'ils font (cristal jaune)
2 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Repo: Comment relancer ses coéquipiers
4 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: Comment obtenir des graines géantes
3 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Combien de temps faut-il pour battre Split Fiction?
3 Il y a quelques semaines By DDD

Article chaud

R.E.P.O. Crystals d'énergie expliqués et ce qu'ils font (cristal jaune)
2 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Repo: Comment relancer ses coéquipiers
4 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: Comment obtenir des graines géantes
3 Il y a quelques semaines By 尊渡假赌尊渡假赌尊渡假赌
Combien de temps faut-il pour battre Split Fiction?
3 Il y a quelques semaines By DDD

Tags d'article chaud

Bloc-notes++7.3.1

Bloc-notes++7.3.1

Éditeur de code facile à utiliser et gratuit

SublimeText3 version chinoise

SublimeText3 version chinoise

Version chinoise, très simple à utiliser

Envoyer Studio 13.0.1

Envoyer Studio 13.0.1

Puissant environnement de développement intégré PHP

Dreamweaver CS6

Dreamweaver CS6

Outils de développement Web visuel

SublimeText3 version Mac

SublimeText3 version Mac

Logiciel d'édition de code au niveau de Dieu (SublimeText3)

Que signifie l'espace réservé en vue Que signifie l'espace réservé en vue May 07, 2024 am 09:57 AM

Que signifie l'espace réservé en vue

Comment écrire des espaces dans vue Comment écrire des espaces dans vue Apr 30, 2024 am 05:42 AM

Comment écrire des espaces dans vue

Comment avoir dom en vue Comment avoir dom en vue Apr 30, 2024 am 05:36 AM

Comment avoir dom en vue

Que signifie span en js Que signifie span en js May 06, 2024 am 11:42 AM

Que signifie span en js

Que signifie rem en js Que signifie rem en js May 06, 2024 am 11:30 AM

Que signifie rem en js

Comment introduire des images dans vue Comment introduire des images dans vue May 02, 2024 pm 10:48 PM

Comment introduire des images dans vue

Quelle est la fonction de la balise span Quelle est la fonction de la balise span Apr 30, 2024 pm 01:54 PM

Quelle est la fonction de la balise span

Comment envelopper l'invite dans js Comment envelopper l'invite dans js May 01, 2024 am 06:24 AM

Comment envelopper l'invite dans js

See all articles