코딩

CSS 개요

생각 나무 2020. 3. 28. 17:33

1. CSS 문법

Selector {declaration ; declaration} 

->  Selector {property: value; property: value;}

2. CSS 선택자 표기

Selector Example Exaple Description
.class .intro "intro"라는 클래스명을 가진 선택자 전체
#id #firstname "firstname"이라는 id명을 지난 선택자 전체
* * 전체 요소를 선택자로 가짐
element p p태그(요소) 전체 선택
element, element, ... div, p div, p 태그 전체 선택

3. 3가 CSS 삽입 방법 (웹문서에 CSS 추가 방법 : 브라우져가 스타일 시트를 읽어 드릴때 스타일시트에 정보에 따라 html 문서를 포맷시킨다. )

External CSS <link rel="stylesheet" type="text/css" href="mystyle.css">
Interal CSS <style> body {background-color: linen; } </style>
Inline CSS <p style="color:red;">This is a paragraph</p>

4. CSS 적용 우선 순위'

4-1. Inline style (inside an HTML element)

4-2. External and internal style sheets (in the head section)

4-3. Browser default