2019年5月11日 星期六

Css-list列表屬性


Css-list列表屬性

有序<ol>
無序<ul>

清單項目標記
List-style-type型態
Circle/square/upper-roman/lower-alpha
List-style-image: url();圖像
List-style-position位置
Outside(預設)/inside

刪除項目標記
List-style-type:none;
但是他還有預設margin padding
所以要設為
ul {
  list-style-type: none;
  margin: 0;

  padding: 0;

}
整合後
ul {
  list-style: square inside url("sqpurple.gif");
}

使用速記屬性時,屬性值的順序為:

list-style-type (如果指定了list-style-image,如果由於某種原因無法顯示圖像,將顯示此屬性的值)
list-style-position (指定列表項標記是否應出現在內容流的內部或外部)
list-style-image (指定圖像作為列表項標記)

Css-link連結屬性


Css-link連結屬性
A:link 未訪問
A:visited 訪問後(點完)
A:hover 游標放在上面時
A:active 點擊中

文字修飾
Text-decoration
None不顯示底線
Underline 顯示底線

Usage
最常用在做按鈕上
或與list合在一起做navbar

Css box-model模型


Css box-model模型
由外到內
Margin-border-padding-content
使用CSS設置元素的寬度和高度屬性時,只需設置內容區域的寬度和高度。要計算元素的完整大小,還必須添加填充,邊框和邊距。

計算整個模型
元素的總寬度應如下計算:
總元素寬度=寬度+左邊距+右邊距+左邊框+右邊框+左邊距+右邊距
元素的總高度應如下計算:
總元素高度=高度+頂部填充+底部填充+頂部邊框+底部邊框+頂部邊距+底部邊距

max-height...屬性(重要概念)


Css寬高屬性
Max-height定義了最大高度
如果內容跑出來可以用overflow處理
內容小於max-height的話,屬性無效
這樣可以防止height屬性變成max,因為max會覆蓋height


Css max-width屬性
定義最大寬度,其他一致

Css min-height
Min-height定義最小高度
如果內容小於高度,則套用高度
若內容大於高度,屬性無效
可以防止heigth屬性的值變成min-height
Css min-width
一致

Css-margins padding屬性


Css-margins屬性 邊距 為border往外延伸之處
四style
Margin-top(right/bottom/left)
每個屬性可以設定的值
1.      auto
2.      width,height
3.      百分比
4.      Inherit預設
合併後
上、右、下、左
p {
  margin: 25px 50px 75px 100px;
}

css-padding屬性 向border內填充
同上

Css-border邊框屬性


Css-border邊框屬性:內容邊框、圖片邊框等等設定
Border-style樣式
dotted - Defines a  短虛線border
dashed - Defines a 虛線 border
solid - Defines a 實線 border 廣泛用到
double - Defines a 雙實線 border
groove - Defines a 3D grooved border. The effect depends on the border-color value
ridge - Defines a 3D ridged border. The effect depends on the border-color value
inset - Defines a 3D inset border. The effect depends on the border-color value
outset - Defines a 3D outset border. The effect depends on the border-color value
none – 無邊界(去掉邊框)
hidden – 藏匿邊框(沒有去掉邊框,而是隱藏他,會占位置)

寬度 border-width
顏色 border-color
p {
  border-top-style: dotted;
  border-right-style: solid;

  border-bottom-style: dotted;

  border-left-style: solid;

}
可以合併
p {
  border: 5px solid red;
}

邊角 border-radius

Css-background屬性


Css-background屬性

Background-color 背景顏色
background-color: color|transparent|initial|inherit;
Specifies that the background color should be transparent. This is default

Background-image  背景圖片
background-image: url|none|initial|inherit;

可用url(); 裡面放連結或是檔案相對位置
linear-gradient (start color , finish color);
一種屬性可以使用來做背景顏色的轉換,所以至少要有兩種顏色(可以更多,用逗號隔開),開始顏色和結束顏色,
語法
background-image: linear-gradient(direction, color-stop1, color-stop2, ...);

direction定義他的顏色的方向和角度
方向 to(bottom center top)(left center right)
角度 90deg、180deg、270deg、360deg(可以玩玩看)
Usage
我常使用的地方是在圖片上覆蓋一層透明的黑色至灰色背景,讓他有層次感。

background-image:
radial-gradient(shape size at position, start-color, ..., last-color);
一個類似從中心往外漸變的屬性(自己理解)
shape 有ellipse預設 、 circle 兩種
size 定義漸變的規模 有farthest-corner預設、closest-side、…
position:開始的地方 預設為center
repeating-linear-gradient()    重複 a linear gradient
repeating-radial-gradient()    重複 a radial gradien
(就是漸變的地方重複,可以看成是背景重複,都差不多)

Background-repeat  背景是否重複
重複有
水平重複repeat-x
圖片往右堆疊
垂直重複repeat-y
圖片往下堆疊
不重複設定 no-repeat
Round屬性:背景圖片會延伸填滿整個瀏覽器,簡單說就是沒有間距
Space: 盡可能重複背景圖像而不剪裁。 第一個和最後一個圖像固定在元素的任一側,並且空白在圖像之間均勻分佈(有間距但均勻分布,會盡量填滿圖片)

Background-attachment  背景固定或捲動
背景圖片要固定或捲動
固定使用fixed
捲動scroll 預設
Local
The background image will scroll with the element's contents
目前沒遇到,改天補充
Background-position  背景位置

若要改變圖片位置,可以設定
Background-position: (left、center、right ) (top、center、bottom)

以上各個屬性可整合在一個background裡
Ex:
Background: #fff  url(“xxx.jpg”)  no-repeat right top;

屬性值的順序為:
  • background-color
  • background-image
  • background-repeat
  • background-attachment
  • background-position

位置設定也可用 x% y%表示 xà左上角開始 yà到右下角

Background-size背景大小
一般: auto自動 cover覆蓋(因為放大圖片容意失真)、contain(只包含圖片原始模樣,所以放背景時無法填滿)
自己能夠設定
1.      width、height(此為固定順序)
2.      百分比

多重背景background: url(),url();
        Background-size: contain,cover;

額外屬性


Background-clip可以設定背景是否在border裡面

background-clip:
border-box(為預設,所以border邊框會在clip裡面)
padding-box(border圍繞在背景外)
content-box(背景延伸到內容邊緣 類似文字或內容等等)
initial 跟預設一樣
inherit 設定完可以讓相同區塊的地方繼承樣式

background-origin 可以設定背景在border或內容裡的位置
background-origin: padding-box|border-box|content-box|initial|inherit;

網頁吸引人的關鍵(about us)


About us網頁製作須注意的事項
1.      客戶看網頁的目的是為了找出能幫他解決問題的人,不會一開始就想知道產品歷史等,因此開頭必須講出你們的優勢及如何幫助客戶。

2.      必須利用簡單的方式列出你能為客戶解決甚麼或提供甚麼價值。

3.      產品或公司的價值在哪。

4.      “let me tell you how we can help you”

5.      喜歡的五大網頁,為何喜歡

6.      優勢à經歷à將所有優勢細分並解釋

7.      獎經歷時幫客戶標重點

8.      將文字變得有個性

9.      建造個人品牌時可在照片旁直接放上你的精力à做中學的歷程à重錯到對

10.  一般人都偏好簡單明瞭的網頁

11.  視覺設計會影響人是否會去注意到文字的區塊。


Css-list列表屬性

Css-list 列表屬性 有序 <ol> 無序 <ul> 清單項目標記 List-style-type 型態 Circle/square/upper-roman/lower-alpha List-style-image...