1. 程式人生 > >初學HTML 05

初學HTML 05

定義 font weight eat image adding 屬性 size -i

框模型
框:頁面上所有的元素都可以稱之為"框"
框模型:(Box Model),又稱為盒子模型,定義框處理元素內容、內邊距、外邊距、邊框的樣式
尺寸
邊框
內邊距
外邊距

外邊距
屬性:margin
margin-方向:

margin-left:5px; 左
margin-right:5px; 右
margin-top:10px; 上
margin-bottom:10px; 下

margin:10px 20px; 上下10 左右20

內邊距

屬性
padding
取值:
px
%

具體格式同margin

背景色
屬性:background-color

背景圖片
屬性:background-image
取值:url(圖像路徑)
background-image:url("");

背景屬性
屬性:background
取值:color url(圖像) repeat attachment position;
background:red url() fixed;
常用方式:
background:url() repeat position;

背景重復
默認情況,背景圖會在水平和垂直兩個方向都出現重復的效果(平鋪)
屬性:background-repeat

取值:
repeat :默認值,水平垂直平鋪
repeat-x : 水平平鋪
repeat-y : 垂直平鋪
no-repeat : 不平鋪(用的最多)

背景圖片固定
屬性:background-attachment
取值:
scroll ,滾動,默認值
fixed,背景圖像固定

背景定位
改變背景圖像在元素中的位置
屬性:background-position
取值:
x y :x表示水平方向移動距離,以屏幕左上角為原點。+向右,-向左,y表示垂直方向移動距離,+向下,-向上

字體相關
1、指定字體
font-family:value,value2,value3 ....;
font-family:"microsoft yahei","arial","verdana";
2、字體大小
font-size:value;
px 或 pt作為單位
font-size:12px;
3、字體加粗
font-weight:normal / bold ;

4、字體樣式(斜體)
font-style:normal/italic;
5、小型大寫字母
font-variant:normal/small-caps;
6、字體屬性
font:font-style font-variant font-weight font-size font-family;

常用方式:
font:font-size font-family;
font:12px "微軟雅黑",arial,verdana;

初學HTML 05