[CS] HTML, CSS, JS - 2

ssoxong·2024년 10월 18일

CS

목록 보기
13/13

CSS

html에 style 적용하는 방법
1. HTML에서 style 태그로 적용 - selector {property: value} 형태
2. <link href=”styles/style.css” rel=”stylesheet” type=”text/css”>
3. <h1 style=”color: red”>h1</h1>
4. 브라우저 기본

1로 갈수록 우선순위가 높아진다.

<!DOCTYPE html>
<html>
<link href="styles/style.css" rel="stylesheet" type="text/css">
<style>
	p{ color: red; text-aligh: center; }
</style>
<h1 style="color:red;">hello red h1</style>
</html>

CSS selector

#id: 하나를 지정해서 스타일 지정 (유일)
.class: 같은 클래스 가진 값에 스타일 지정
기본 태그.class 형태로 사용할 수 있다 (p.clasName)

border

shorthand - 축약해서 표현 (border-top, border-right…등)
border-style: dotted solid # 위아래 왼오
border-style: dotted solid double # 위 왼오 아래

box-model

margin: 엘리먼트 경계선 바깥 여백
paddin: 엘리먼트 안쪽 공간 여백

a:link
a:visited # 방문한 사이
a:hover # 마우스 갖다댔을 때
a:active #누르는 순간

display

display: none (사라짐) / visibility: hidden (안보임)
display: inline / display: block

profile
배운 것을 기록하는 습관

0개의 댓글