CSS/CSS 이론에따라 직접해보기
블럭-인라인 ,스타일시트
임혁진
2024. 1. 24. 08:52
블럭 요소와 인라인 요소
블럭
- 자동으로 줄바꿈
- 블럭안에 블럭, 인라인요소 가능
- 대표적으로 <p> <div> <ul> <li> <aside> <section> <form> 등이 있다
인라인
- 컨텐츠의 내용이 곧 너비
- 인라인 안에는 인라인만 가능하다
- 대표적으로 <a> ,<img> ,<b>,<strong> , <label> ,<input> , <span> , <i> 등이 있다
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h2>헬로월드(라이브가상서버)</h2>
<h2>저장하면 바로 반영된다</h2>
<!--
블럭요소
자동으로 줄바꿈이 되고 , 블럭안에는 블럭요소 or 인라인요소를 넣어도됩니다
-->
<p>블럭요소</p>
<div>블럭요소</div>
<ul>
<li>블럭요소</li>
</ul>
<aside>블럭요소</aside>
<section>블럭요소</section>
<form>
블럭요소
</form>
<!--
인라인요소
컨텐츠의 내용이 너비가 됩니다(줄바꿈없음)
인라인안에는 인라인요소만 넣을 수 있다.
-->
<a href = "" >인라인</a>
<img src=""xxx.png" alt="">
<b>인라인</b>
<strong>인라인</strong>
<small>inline</small>
<label for="">인라인</label>
<input type="text">
<span>인라인</span>
<i>인라인</i>
<!--
div, sapn 둘다 디자인요소의 영역을 잡을 때 사용합니다
세로배치시에는 div (블록)
가로배치시에는 span (인라인)
-->
<!-- <a href ="#">
<p>
aaa
</p>
</a> 인라인 안에 블록이라 아래 것처럼 표현한다-->
<p>
<a href = "#">aaa</a>
</p>
</body>
</html>
스타일시트
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<!-- link태그를 이용해서 임포트-->
<link rel = "stylesheet" href="css/indexo02.css">
<style>
h2{color:#008000;}
h1{color:aqua;}
</style>
</head>
<body>
<p>외부 스타일시트</p>
<h1>외부 스타일시트</h1>
<h2>내부 스타일시트</h2>
<h2 style = "color:#999999;"></h2>
<p style="color:blueviolet; font-size: 35px;">인라인시트</p>"
</body>
</html>
link를 통한 방법,
<style> 태그를 이용한 방법
body 안 태그에서 직접 사용하는 방법 이 있다.