CSS

选择器

css中的选择器

背景颜色、图像

background background-attachment background-clip background-color background-image background-origin backgrond-position background-repeat background-size

文字、字体

color font font-family font-size font-size-adjust font-style font-variant font-weight

文档格式

hanging-punctuation hyphens letter-spacing line-height text-align text-decoration text-indent text-overflow text-shadow text-transform white-space word-spacing word-wrap

宽度和高度

width,height max-width min-width max-height min-height

外缘与内缘余白

margin margin-bottom margin-left margin-right margin-top padding padding-bottom padding-left padding-right padding-top

边框

border border-bottom border-color border-style border-width border-top border-right border-left

边框圆角

border-radius border-bottom-right-radius border-bottom-left-radius border-top-right-radius border-top-left-radius

边框图像

border-image border-image-repeat border-image-slice border-image-source border-image-width

容器与弹性容器

bottom clear clip box-decoration-break box-shadow align-content align-items align-self display flex-basis flex-direction flex-flow flex-grow flex-shrink flex-wrap justify-content float left outline-offset overflow overflow-x overflow-y order position right resize top vertical-align z-index

透明

opacity rgba

渐变

linear-gradient radial-gradient

文章分栏

break-after break-before break-inside columns column-count column-fill column-gap column-rule column-rule-color column-rule-style column-rule-width column-span column-width

时间过渡效果

transition transition-delay transition-duration transition-property transition-timing-function

动漫效果

@keyframes animation animation-delay animation-direction animation-duration animation-fill-mode animation-iteration-count animation-name animation-play-state animation-timing-function

2D、3D变形

transform translate matrix2d matrix3d perspective scale skew rotate transform-origin

颜色、尺寸、单位

角度与URL 颜色 单位长度

表格

border-collapse border-spacing caption-side empty-cells table-layout

列表

counter-increment counter-reset list-style list-style-type list-style-image list-style-position

基本的用户界面属性

box-sizing content cursor nav-index nav-left nav-down nav-right nav-up

CSS基础

border-width(边线的宽度)

border-width: 值;

border-width: 1px;

border-width属性用于指定边线的宽度,有多个值时,值之间用半角空格间隔。

值得个数及含义

  • 1个值:上下左右的宽度
  • 2个值:上下、左右的宽度
  • 3个值:上、左右、下的宽度
  • 4个值:上、右、下、左的宽度
border-width值得 说明及其技术细节
说明 演示
数值 使用数值指定边线宽度,
数值单位除了px外,其他还有em、ex(1ex=小文字[x]的1个高度)。详细参照数值+单位
演示
关键词 thin(细)、medium(普通)、thick(粗)。
initial 保持原有属性的值。
inherit 继承母元素的设定。
默认值:medium
继承:不继承
能否动画:能
CSS版本:CSS1
JavaScript语法:object.style.borderWidth="1px 5px"

css文件

.sample1,.sample2,.sample3,.sample4,.sample5,.sample6,.sample7,

.sample8,.sample9{

margin:0.5em;

padding:2px;

border-color:#ffff00;

border-style:solid;

}

.sample1 {border-width: 1px;}

.sample2 {border-width: 1em;}

.sample3 {border-width: 1ex;}

.sample4 {border-width: thin;}

.sample5 {border-width: medium;}

.sample6 {border-width: thick;}

.sample7 {border-width: 5px 10px;}

.sample8 {border-width: 5px 10px 15px;}

.sample9 {border-width: 5px 10px 15px 20px;}

链接了上述css文件的html文件

<!DOCTYPE html>

<html lang="zh">

<head>

<meta charset="UTF-8" /><meta name="viewport" content="width=device-width, initial-scale=1">

<link href="material/border-width.css" rel="stylesheet" type="text/css" />

<title>border-width属性</title>

</head>

<body>

<div class="sample1">sample1:1px</div>

<div class="sample2">sample2:1em</div>

<div class="sample3">sample3:1ex</div>

<div class="sample4">sample4:thin</div>

<div class="sample5">sample5:medium</div>

<div class="sample6">sample6:thick</div>

<div class="sample7">sample7:上下5px、左右10px</div>

<div class="sample8">sample8:上5px、左右10px、下15px</div>

<div class="sample9">sample9:上5px、右10px、下15px、左20px</div>

</body>

</html>

浏览器上的显示结果↓

 border-width属性
sample1:1px
sample2:1em
sample3:1ex
sample4:thin
sample5:medium
sample6:thick
sample7:上下5px、左右10px
sample8:上5px、左右10px、下15px
sample9:上5px、右10px、下15px、左20px
X

浏览器支持情况

IE9IE8Fx4.0Fx3.6Chrome11Safari5Opera11