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

slike bài giảng web thế hệ mới - trương thị diệu linh 1.3 chapter 4 css

50 324 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 50
Dung lượng 1,58 MB

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

Nội dung

 Change the apparence of the document easily without changing the HTML code  Change style of a page easily environment... Link CSS with HTML HTML document contains content of a web p

Trang 1

Chapter 4: CSS

Trang 3

Style sheet

 Style sheet describes how documents are

presented on screens, in print, or perhaps how they are pronounced

 Separate structure and presentation

 W3C has actively promoted the use of style

Trang 4

Advantage of StyleSheet

content and simple structure

 Change the apparence of the document easily without changing the HTML code

 Change style of a page easily

environment

Trang 5

Example of page using stylesheet

Trang 6

A document with different style

Trang 7

A document with different style

Trang 8

A document with different style

Trang 9

Document without style

Trang 10

Link CSS with HTML

 HTML document contains content of a web

page

 CSS document contains the presentation style

 3 ways for defining a style for a HTML

document

link it with the HTML document

Trang 11

Link CSS with HTML: Inline

In-line styles are plonked straight into the

HTML tags using the style attribute.

<p style="color: red">text</p>

it

presentation dependant should be

avoided

Trang 12

Link CSS with HTML: Internal

Internal styles are used for the whole page

Styles are defined inside the head section, surrounded by <style>

 Better than in-line styles, the styles and HTML code are more

independent by still include in one document

Trang 13

Link CSS with HTML: External

CSS document

HTML document

Trang 14

Syntax of CSS

 CSS contain rules that defines styles for HTML document

presentation of the content

 It is recommended that the HTML tags serving for the presentation such as <font>, <b> , <i> should be not be used

Trang 20

object that has the given class

Trang 21

<h1 class="important> Tieu de quan trong </h1>

<p class="important> Vi du mot doan quan trong </p>

<p class=“brazil”> Mau co Brazil </p>

<p> Day la mot doan khac </p>

Trang 22

for all objects

 * {attribute: value; }

 *{font-size: large;}

Trang 23

Selector Pseudo-class

effects to a selector when there is user interaction

Syntax

Ex

Trang 25

Selector Pseudo-class

a:link { color: red }

a:visited { color: green }

a:hover { background-color: yellow } a:active { background-color: pink }

Trang 26

/*This is another comment */

color: black; font-family: arial }

Trang 27

CSS attributes for text

Trang 28

CSS attributes for background

Trang 29

CSS attributes for font

Trang 30

<html>

<head>

<style type="text/css">

p.normal {font-variant: normal}

p.small {font-variant: small-caps}

Trang 31

CSS attributes for list

Trang 33

CSS attributes for table

Trang 34

<html>

<head>

<style type="text/css">

table.coll { border-collapse: collapse }

table.sep { border-collapse: separate }

Trang 35

Frame model

 Some HTML elements

are displayed in a frame

Day la mot doan van ban nam trong khung No cach border cua khung cac doan padding Day la mot doan van ban nam trong khung No cach border cua khung cac doan padding.

Top margin

paddin g

bottom margin

Khung

Trang 36

Frame model- Border

color and style

 Width : width of the border

Trang 37

Frame model- Border

 Example

{ border: thick solid green;

}

width style color

Trang 38

Frame model- Border

 Characteristic of the border can be defined with different attribute:

Trang 39

Frame model - Border

displayed differently

corresponding to 4 edges of the border

 Ex:

p.four_borders

{

border-width: thick;

border-style: solid dashed dotted double;

border-color: green blue red yellow;

}

Trang 40

Frame model- Margin

by %.

Trang 41

Frame model- Margin

Trang 42

Frame model - Padding

 Padding define the distance between the

content and the border

 Attributes of padding are defined similarly to

margin, howerverthe value cannot be

Trang 43

Frame model - Alignment

Trang 44

Frame model - Indentation

at the beginning of the line

Trang 45

Frame model- line-height

 line-height defines the height of a line including the height of its characters and the space with another line

Trang 46

Frame model – width, height

height of a frame

Number of pixel: 300px

Cm : 5cm

%, relative values with the width or the height

of browser window Ex: 50%

Trang 48

Frame model: Float

 Float defines how a HTML element should be aligned in comparison with its parent.

#section2 { float: right;

width: 300px;

background-color: yellow;

}

Trang 49

Frame model: Float

Ngày đăng: 24/10/2014, 14:55

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm