css를 사용하는 방법은 두가지 있다.
1. inline 방식 (style tag를 사용한다.)
<!DOCTYPE html>
<html>
<head>
<style>
body{
margin:20px;
display:flex;
justify-content: space-evenly;
align-items: center;
}
</style>
</head>
<body>
<div></div>
</body>
</html>
다음과 같은 방식으로 작성할 수 있다. (<style>태그는 <head> 태그 안에 존재하여야함.)
2. css 파일을 따로 만들어 작성하는 방식 (<link>태그를 이용)
<!DOCTYPE html>
<html>
<head>
<link href="styles.css" rel="stylesheet"/>
</head>
<body>
<div></div>
</body>
</html>
styles.css 라는 파일을 만들고 html 에서 <link>태그를 이용하여 연결시켜줌.
styles.css -> css 파일 이름.
stylesheet -> styles.css 와 html의 관계를 나타냄.
'웹 프로그래밍 > css' 카테고리의 다른 글
selector, state (0) | 2023.09.02 |
---|---|
position: relative, absolute, fixed, static (0) | 2023.08.27 |
margin, padding , border (0) | 2023.01.05 |
박스 display: (block , inline, inline-block) (0) | 2023.01.05 |
css 작성법 ( id, class ) (0) | 2023.01.05 |