自强学堂
自强学堂:学习、分享、让你更强!
CSS 参考手册HTMLCSSJAVASCRIPTJQUERYSQLPHPBOOTSTRAPANGULARXML
×

CSS 参考手册

CSS 参考手册 CSS 选择器 CSS 语音参考 CSS Web安全字体 CSS 单位 CSS 颜色 CSS 合法颜色值 CSS 颜色名称 CSS 颜色十六进制值 CSS 浏览器支持

CSS 属性

align-contentalign-itemsalign-selfanimationanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-function appearance backface-visibility background background-attachment background-clip background-color background-image background-origin background-position background-repeat background-size border border-bottom border-bottom-color border-bottom-left-radiusborder-bottom-right-radius border-bottom-style border-bottom-width border-collapse border-color border-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-width border-left border-left-color border-left-style border-left-width border-radius border-right border-right-color border-right-style border-right-width border-spacing border-style border-top border-top-color border-top-left-radiusborder-top-right-radius border-top-style border-top-width border-width bottom box-align box-direction box-flex box-flex-group box-lines box-ordinal-group box-orient box-pack box-shadow box-sizing caption-side clear clip color column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width columns content counter-increment counter-reset cursor direction display empty-cells flexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrap float font @font-face font-family font-size font-size-adjustfont-stretch font-style font-variant font-weight grid-columns grid-rows hanging-punctuation height icon justify-content@keyframes left letter-spacing line-height list-style list-style-image list-style-position list-style-type margin margin-bottom margin-left margin-right margin-top max-height max-width min-height min-width nav-down nav-index nav-left nav-right nav-up opacity order outline outline-color outline-offset outline-style outline-width overflow overflow-x overflow-y padding padding-bottom padding-left padding-right padding-top page-break-after page-break-before page-break-inside perspective perspective-origin position punctuation-trim quotes resize right rotation tab-size table-layout target target-name target-new target-position text-align text-align-last text-decoration text-decoration-colortext-decoration-linetext-decoration-style text-indent text-justify text-outline text-overflow text-shadow text-transform text-wrap top transform transform-origin transform-style transition transition-delaytransition-duration transition-property transition-timing-function unicode-bidi vertical-align visibility white-space width word-break word-spacing word-wrap z-index

 

CSS 合法颜色值

CSS Colors

CSS的颜色可以通过以下方法指定:

  • 十六进制颜色
  • RGB颜色
  • RGBA颜色
  • HSL色彩
  • HSLA颜色
  • 预定义/跨浏览器的颜色名称

十六进制颜色

所有主要浏览器都支持十六进制颜色值。

指定一个十六进制的颜色其组成部分是:#RRGGBB,其中RR(红色),GG(绿色)和BB(蓝色)。所有值必须介于0和FF之间。

实例

p
{
background-color:#ff0000;
}

尝试一下 »


RGB颜色

RGB颜色值在所有主要浏览器都支持。

RGB颜色值指定:RGB(红,绿,蓝)。每个参数(红色,绿色和蓝色)定义颜色的亮度,可在0和255之间,或一个百分比值(从0%到100%)之间的整数。

例如RGB(0,0,255)值呈现为蓝色,因为蓝色的参数设置为最高值(255)而其他设置为0。

此外,下面的值定义相同的颜色:RGB(0,0,255),RGB(0%,0%,100%)。

实例

p
{
background-color:rgb(255,0,0);
}

尝试一下 »


RGBA颜色

RGBA颜色值被IE9, Firefox3+, Chrome, Safari,和Opera10+支持。

RGBA颜色值是RGB颜色值alpha通道的延伸 - 指定对象的透明度。

RGBA颜色值指定:RGBA(红,绿,蓝,alpha)。 Alpha参数是一个介于0.0(完全透明)和1.0(完全不透明)之间的参数。

实例

p
{
background-color:rgba(255,0,0,0.5);
}

尝试一下 »


HSL颜色

IE9, Firefox, Chrome, Safari,和Opera 10+.支持HSL颜色值。

HSL代表色相,饱和度和亮度 - 使用色彩圆柱坐标表示。

HSL颜色值指定:HSL(色调,饱和度,明度)。

色相是在色轮上的程度(从0到360)-0(或360)是红色的,120是绿色的,240是蓝色的。饱和度是一个百分比值;0%意味着灰色和100%的阴影,是全彩。亮度也是一个百分点;0%是黑色的,100%是白色的。

实例

p
{
background-color:hsl(120,65%,75%);
}

尝试一下 »


HSLA颜色

HSLA颜色值被IE9, Firefox3+, Chrome, Safari,和Opera10+.支持.

HSLA的颜色值是一个带有alpha通道的HSL颜色值的延伸 - 指定对象的透明度。

指定HSLA颜色值:HSLA(色调,饱和度,亮度,α),α是Alpha参数定义的不透明度。 Alpha参数是一个介于0.0(完全透明)和1.0(完全不透明)之间的参数。

实例

p
{
background-color:hsla(120,65%,75%,0.3);
}

尝试一下 »


预定义/跨浏览器的颜色名称

147是在HTML和CSS颜色规范预定义的颜色名称。你可以查看我们的预定义颜色名称表