2. CSS

CSS Border 의 성질

도피디 2024. 11. 18. 21:27
반응형

Style 속성을 이용해서 border가 어떻게 보일지 정할 수 있다.

<!DOCTYPE html>
<html lang="kr">
<head>
<title>The Nick Times</title>
<style>
* {
border: 2px dashed black;
}

html {
background-color: tomato;
}
body {
margin: 20;
padding: 20px;
background-color: thistle;
}
div {
padding: 20px;
}
#first {
background-color: whitesmoke;
width: 150px;
height: 150px;
}
#second {
background-color: teal;
width: 100px;
height: 100px;
}
#third {
background-color: wheat;
width: 50px;
height: 50px;
}
#fourth {
background-color: blanchedalmond;
width: 20px;
height: 20px;
}
</style>
</head>
<body>
<div id="first">
<div id="second">
<div id="third">
<span>hello</span>
</div>
</div>
</div>
</div>
</body>
</html>

 

 

 

결과

borderinline과 block 모두에 적용된다.

 

(inline 인 span 태그에도 border가 적용이 됨)

반응형

'2. CSS' 카테고리의 다른 글

CSS Class(클래스) 적용하기  (0) 2024.11.18
CSS inline의 margin(마진)은 좌우로만 가질 수 있다.  (0) 2024.11.18
CSS Border 태그  (0) 2024.11.18
CSS 여러개의 div의 padding 적용하기  (0) 2024.11.17
CSS padding (패딩)  (0) 2024.11.17