2. CSS

CSS <span> 태그 특징 (inline)

도피디 2024. 11. 13. 00:35
반응형
<!DOCTYPE html>
<html lang="kr">
<head>
<title>The Nick Times</title>
<style>
div {
height: 150px;
width: 150px;
background-color: tomato;
}
span {
background-color: turquoise;
}
</style>
</head>
<body>
<div></div>
<div></div>
<div></div>
<span>hello</span>
<span>hello</span>
<span>hello</span>
</body>
</html>

 

 

 

 

 

결과

 

span 은 박스와 다르게 span 옆에 바로 다른 span이 올 수 있다.

 


<!DOCTYPE html>
<html lang="kr">
<head>
<title>The Nick Times</title>
<style>
div {
height: 150px;
width: 150px;
background-color: tomato;
}
span {
background-color: turquoise;
}
</style>
</head>
<body>
<div></div>
<div></div>
<div></div>
<span>hello</span>
<span>hello</span>
<span>hello</span>
<a href="#">link</a>
</body>
</html>

 

 

결과

link 도 바로 옆에 위치할 수 있다.

 


 

(box가 아닌) span, link, image 등의 특징을

inline 이라고 명칭한다. 

 

* inline: in the same line (같은 줄에 위치할 수 있다)

 

그리고 inline은 높이와 너비를 가질 수 없다.

 

반응형