Interactive Media Design and Production-----CSS

一. What is CSS?

•CSS stands for Cascading Style Sheets
•CSS describes how HTML elements are to be displayed on screen, paper, or in other media
•CSS saves a lot of work. It can control the layout of multiple web pages all at once •External stylesheets are stored in CSS files
在這裏插入圖片描述

二.CSS Style & Rules

Style

在這裏插入圖片描述

CSS rules

•A CSS rule-set consists of a selector and a declarationblock:
• The selector points to the HTML element you want tostyle
• The declaration block contains one or more declarations separated by semicolons.
• Each declaration includes a CSS property name and a value, separated by a colon.
• A CSS declaration always ends with a semicolon, and declaration blocks are surrounded by curly braces.
在這裏插入圖片描述
在這裏插入圖片描述

CSS Syntax and Selectors

在這裏插入圖片描述
若要對選擇器進行分組,請使用逗號分隔每個選擇器

三. Inline, Internal & External Style Sheets

What Does “Cascading” Mean?

We use the term “cascading” because there is an established order of priority to resolve formatting conflicts:

  1. Inline style (highest priority)
  2. Internal style sheet (second priority)
  3. External style sheet (third priority)
  4. Web browser default (only if not defined elsewhere)
    在這裏插入圖片描述

Three Ways to Use CSS

在這裏插入圖片描述

Inline Style由於作用域有限,本課程不會過多使用

在這裏插入圖片描述

Internal Style Sheet

在這裏插入圖片描述

External Style Sheet

在這裏插入圖片描述
在這裏插入圖片描述

四. Class, ID, Pseudo-Class, Pseudo-Element

HTML Class

在這裏插入圖片描述
在這裏插入圖片描述

HTML ID

在這裏插入圖片描述
在這裏插入圖片描述

CSS Syntax and Selectors

pseudo-class僞類
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述

五. CSS Box Model

•All HTML elements can be considered as boxes
•The CSS box model is essentially a box that wraps around every HTML element. It consists of: margins, borders, padding, and the actual content.
在這裏插入圖片描述
在這裏插入圖片描述
在這裏插入圖片描述

六. CSS Property, units

在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章