1. Trang chủ
  2. » Công Nghệ Thông Tin

Tài liệu tự học CSS nhanh

154 205 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 154
Dung lượng 1,24 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

– The !important Declaration– The execution order of the... – The !important Declaration– The execution order of the... – The !important Declaration– The execution order of the... Defini

Trang 1

Cascading Style Sheet

Trang 4

• Can be written in html or css file

• Consists of a list of rule sets

• A Rule set consists of:

Trang 7

Introduction

-CSS added in HEAD section - EXTERNAL

• Html file

• Css file

Trang 16

ID selector

• Definition:

– Apply CSS rule to only one ID.

– An ID selector can appear many times in CSS file – An ID selector can appear one time in html tag.

Trang 18

– The !important Declaration

– The execution order of the

Trang 20

Figure 1: Example of inheritance

Trang 21

– The !important Declaration

– The execution order of the

Trang 23

Grouping Selectors

• Example:

Trang 24

– The !important Declaration

– The execution order of the

Trang 25

Defining CSS rules to child selectors

Trang 26

Defining CSS rules to child selectors

• Example:

Figure 3: Define CSS rules for child

Trang 27

– The !important Declaration

– The execution order of the

Trang 28

The !important Declaration

Trang 29

The !important Declaration

• Example:

Figure 4: Example of !important declaration

Trang 30

– The !important Declaration

– The execution order of the

Trang 31

The execution order of the CSS rules

• Inline > internal > external

• !importance declaration has top priority

• More detail has higher priority

• Later has higher priority

Trang 32

– The !important Declaration

– The execution order of the

Trang 33

Adding Comments within Stylesheets

property:value;

}

Trang 35

• Accepts a comma-separated list

• Enclose font that contains spaces with “xy z”

• Insert generic font at the end of list

• Five generic font-family values:

– serif

– sans-serif

– cursive

– monospace

Trang 38

Font Embedding

• Used to include a font other than general

• Embed new font with @font-face

• To use this CSS rule, set two properties:

– font-family

– src

Trang 41

• Controls size of text

• Can be defined in:

Trang 42

• Example:

Figure 5: Example of font-size

Trang 44

• Controls thickness of font

• Can take on different values:

Trang 45

• Example:

Trang 48

• Example:

Figure 7: Example of font-variant

Trang 51

• Example:

Trang 53

Multiple values for font property

• Set many font properties in one definition

• Use font property

• Syntax:

selector {

font: font-style_val

font-variant_val font-weight_val font-size_val font-family_val;

Trang 54

Multiple values for font property

• Example:

Figure 9: Using font style

Trang 57

• Example:

Trang 60

• Example:

Figure 11: Example of word-spacing

Trang 63

• Example:

Trang 66

• Example:

Figure 13: Example of text-transform

Trang 69

• Example:

Trang 72

• Example:

Figure 15: Example of vertical-align

Trang 75

• Example:

Trang 78

• Example:

Figure 17: Example of text-decoration

Trang 81

• Example:

Trang 84

• Example:

Trang 87

• Example:

Trang 89

• Is applied throughout content area of element

• Is drawn behind background-image

Trang 90

• Example:

Figure 21: Example of background-color

Trang 93

• Example:

Trang 96

• Example:

Figure 23: Example of background-repeat

Trang 99

• Example:

Trang 102

• Example:

Figure 25: Example of background-position

Trang 104

Multiple values for background property

• Add many background properties in one definition

• Syntax:

selector {

background: bg_color

bg_image bg_repet bg_attach bg_position;

}

Trang 105

Multiple values for background property

• Example:

Trang 107

• Is a box that wraps around HTML elements

Trang 109

width and height

• Defines width and

height of the content

Trang 110

width and height

• Example:

Figure 28: Example of width and height

Trang 113

• Example:

Trang 115

• Sets space between element

border and content area

Trang 116

• Example:

Figure 30: Example of padding

Trang 119

• Example:

Trang 121

Min and max dimensions

• Places restrictions on element’s size

Trang 123

Example

Trang 125

CSS Border

• For student!

Trang 127

CSS outline

• For student!

Trang 128

• Positioning

• CSS Float and Clear

• Pseudo-classes

• Reference

Trang 130

• Example:

Figure 37: Example of using display

Trang 133

• Example:

Trang 134

– Define the visible portion of an element

• Positioning

• CSS Float and Clear

• Pseudo-classes

• Reference

Trang 135

Define the visible portion of an element

• Use visible surface

Trang 136

Define the visible portion of an element

• Example:

Figure 39: Visible portion of an element

Trang 137

• CSS Float and Clear

• Pseudo-classes

• Reference

Trang 138

• Default value

• Not uniquely positioned

• Are not affected by:

Trang 139

• CSS Float and Clear

• Pseudo-classes

• Reference

Trang 140

Figure 40: Relative positioning

Trang 141

relative

Trang 142

– absolute

– fixed – z-index

• CSS Float and Clear

• Pseudo-classes

• Reference

Trang 143

• An absolute position element

– Is positioned relative to the first parent element

that has a position other than static, or <html> if

no such element exists, and its display is not

affected by other elements.

– Absolute positioning takes the element out of the normal document flow, and can overlap other

elements.

• Syntax:

Trang 144

Figure 41: Absolute positioning

Trang 146

• Based on the viewport window

• Can overlap other element

• Not move even if the window is scrolled

Trang 147

– z-index

• CSS Float and Clear

• Pseudo-classes

• Reference

Trang 148

Figure 42: Using z-index positioning

Trang 150

CSS Float and Clear

• For students!

Trang 152

• For students!

Trang 154

• http://coursesweb.net/

• http://www.w3schools.com/

Ngày đăng: 30/10/2015, 15:28

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w