HTML快捷鍵+tab鍵自動補齊
- 直接鍵入標簽名稱
- 加類名
div.className - 加id名
div.idName - 父子關系
ul>li - 兄弟關系
img+a -
$符號,會從0-n自動填充(div.className$)*6 -
*符號,會復制同類多個標簽ul>li*6
CSS快捷鍵+tab鍵自動補齊
文字屬性
-
font-style
-
fsfont-style: italic; -
fsnfont-style: normal;
-
-
font-weight
-
fwfont-weight:; -
fwbfont-weight: bold; -
fwbrfont-weight: bolder;
-
-
font-size
-
fzfont-size:; -
fz30font-size: 30px
-
-
font-family
-
fffont-family: ;
-
-
font縮寫
-
font: style weight size family; -
font: italic bold 10px "楷體";
-
ps注意點:
- 在這種縮寫格式中有的屬性值可以省略
sytle可以省略,weight可以省略 - 在這種縮寫格式中style和weight的位置可以交換
- 在這種縮寫格式中有的屬性值是不可以省略的,
size不能省略,family不能省略 - size和family的位置是不能順便亂放的,
size一定要寫在family的前面, 而且size和family必須寫在所有屬性的最后
文本屬性
-
text-decoration
-
tdtext-decoration: none; -
tdutext-decoration: underline; -
tdltext-decoration: line-through; -
tdotext-decoration: overline;
-
-
text-align
-
tatext-align: left; -
tartext-align: right; -
tactext-align: center;
-
-
text-indent
-
titext-indent:; -
ti2etext-indent: 2em;
-
顏色屬性
-
color
-
ccolor: #000;
-
ps注意點:顏色的取值有4種方式
- 英文單詞.如
white,black,blue,green,red等等 - rgb三原色.其中r(
red紅色) g(green綠色) b(blue藍色) - rgbg.a(
alpha)代表透明度 - 16進制.如
#fff,#f12345
CSS的顯示模式
-
display
-
didisplay: inline; -
dbdisplay: block; -
dibdisplay: inline-block;
-
ps注意點:
- 塊級元素(
block)- 獨占一行
- 如果沒有設置寬度, 那么默認和父元素一樣寬
- 如果設置了寬高, 那么就按照設置的來顯示
- 行內元素(
inline)- 不會獨占一行
- 如果沒有設置寬度, 那么默認和內容一樣寬
- 行內元素是不可以設置寬度和高度的
- 行內塊級元素(
inline-block)- 為了能夠讓元素既能夠不獨占一行, 又可以設置寬度和高度, 那么就出現(xiàn)了行內塊級元素
背景顏色
-
background-color
-
bcbackground-color: #fff;
-
背景圖片
-
background-image
-
bibackground-image: url();
-
背景平鋪
-
background-repeat
-
bgrbackground-repeat: -
bgrxbackground-repeat: repeat-x; -
bgrybackground-repeat: repeat-y; -
bgrnbackground-repeat: no-repeat;
-
ps注意點:
- repeat 默認, 在水平和垂直都需要平鋪
- no-repeat 在水平和垂直都不需要平鋪
- repeat-x 只在水平方向平鋪
- repeat-y 只在垂直方向平鋪
背景關聯(lián)
- background-attachment
-
babackground-attachment:; -
basbackground-attachment: scroll; -
bafbackground-attachment: fixed;
背景連寫
-
background縮寫(背景顏色 背景圖片 平鋪方式 關聯(lián)方式 定位方式)
-
bg+background: #fff url() 0 0 no-repeat;
-
ps背景圖片和插入圖片的區(qū)別
- 背景圖片僅僅是一個裝飾, 不會占用位置
插入圖片會占用位置 - 背景圖片有定位屬性, 所以可以很方便的控制圖片的位置;插入圖片沒有定位屬性, 所有控制圖片的位置不太方便
- 插入圖片的語義比背景圖片的語義要強, 所以在企業(yè)開發(fā)中如果你的圖片想被搜索引擎收錄, 那么推薦使用插入圖片
邊框
-
border
-
bdtborder-top:; -
bdrborder-right:; -
bdbborder-bottom:; -
bdlborder-left:; -
bd+border: 1px solid #000;
-
-
border-xx-xx
-
btwborder-top-width:; -
btsborder-top-style:; -
btcborder-top-color: #000;
-
ps類似的還有border-direction-attribute
外邊距
-
padding
-
ptpadding-top:; -
prpadding-right:; -
pbpadding-bottom:; -
plpadding-left:;
-
內邊距
-
margin
-
mtmargin-top:; -
mrmargin-right:; -
mbmargin-bottom:; -
mlmargin-left:;
-
浮動
-
float
-
flfloat: left; -
frfloat: right;
-
定位
-
psaposition: absolute; -
psposition: relative;