floating ì리먼í¸ì ìì
floating ì리먼í¸ë¤ì ìì ììë ì½ê° ë¤ë¥´ë¤. floating ì리먼í¸ë¤ì positionì´ ì§ì ë ë¸ë¡ê³¼ ì§ì ëì§ ìì ë¸ë¡ ì¬ì´ì ìì¸ë¤.
- ë¿ë¦¬ ì리먼í¸ì 배경과 í ë리
- ìì ì리먼í¸ë¤ì HTMLìì ë±ì¥íë ììëë¡
- floating ì리먼í¸
- positionì´ ì§ì ë ìì ì리먼í¸ë¤ì HTMLìì ë±ì¥íë ììëë¡
ì¬ì¤ ë¤ì ìì ìì ë³´ë ê²ì²ë¼ positionì´ ì§ì ëì§ ìì ì리먼í¸(DIV #4)ì 배경과 í ë리ë floating ì리먼í¸ë¤ì ìí´ ìí¥ì ë°ì§ ìëë¤. ë°ë©´ 컨í ì¸ ë ìí¥ì ë°ëë¤. ì´ê²ì CSS íì¤ float ëª ì¸ì ë°ë¥¸ ê²ì´ë¤.
ìì ê·ì¹ 리ì¤í¸ë¥¼ ìì íì¬ ì´ ëª ì¸ë¥¼ í¬í¨ìì¼ë³´ì.
- ë¿ë¦¬ ì리먼í¸ì 배경과 í ë리
- ìì ì리먼í¸ë¤ì HTMLìì ë±ì¥íë ììëë¡
- floating ì리먼í¸
- inline ìì ì리먼í¸ë ë³´íµì íë¦ëë¡
- positionì´ ì§ì ë ìì ì리먼í¸ë¤ì HTMLìì ë±ì¥íë ììëë¡
ì°¸ê³ : ë ¸í¸: ìë ìì ìì positionì´ ì§ì ëì§ ìì ìë¦¬ë¨¼í¸ ì´ì¸ìë 모ë ì리먼í¸ê° ìì ìì를 ë³´ì¬ì£¼ê¸° ìí´ ë°í¬ëª íê² ì¤ì ëìë¤. ë§ì½ positionì´ ì§ì ëì§ ìì ìë¦¬ë¨¼í¸ (DIV #4)ì í¬ëª ë를 ë®ì¶ë©´ ì´ìí ì¼ì´ ì¼ì´ëë¤. 배경과 í ëë¦¬ê° (ìëìë floating ìë¦¬ë¨¼í¸ ìëì ìì´ì¼ í¨ìë ë¶êµ¬íê³ ) floating ì리먼í¸ì positionì´ ì§ì ë ìë¦¬ë¨¼í¸ ì¬ì´ì ë³´ì´ë ê²ì´ë¤. ì´ê²ì´ ëª ì¸ì ì¼ë¶ì¸ì§ ìëë©´ ë²ê·¸ì¸ì§ íì¤íì§ ìë¤. í¬ëª ë를 ì ì©íëê²ì´ ìë¡ì´ ìì ë§¥ë½(stacking context)를 ë§ëë ê²ì¼ê¹?
ìì
>HTML
<div id="abs1"><strong>DIV #1</strong><br />position: absolute;</div>
<div id="flo1"><strong>DIV #2</strong><br />float: left;</div>
<div id="flo2"><strong>DIV #3</strong><br />float: right;</div>
<br />
<div id="sta1"><strong>DIV #4</strong><br />no positioning</div>
<div id="abs2"><strong>DIV #5</strong><br />position: absolute;</div>
<div id="rel1"><strong>DIV #6</strong><br />position: relative;</div>
CSS
div {
padding: 10px;
text-align: center;
}
strong {
font-family: sans-serif;
}
#abs1 {
position: absolute;
width: 150px;
height: 200px;
top: 10px;
right: 140px;
border: 1px dashed #900;
background-color: #fdd;
}
#sta1 {
height: 100px;
border: 1px dashed #996;
background-color: #ffc;
margin: 0px 10px 0px 10px;
text-align: left;
}
#flo1 {
margin: 0px 10px 0px 20px;
float: left;
width: 150px;
height: 200px;
border: 1px dashed #090;
background-color: #cfc;
}
#flo2 {
margin: 0px 20px 0px 10px;
float: right;
width: 150px;
height: 200px;
border: 1px dashed #090;
background-color: #cfc;
}
#abs2 {
position: absolute;
width: 150px;
height: 100px;
top: 80px;
left: 100px;
border: 1px dashed #990;
background-color: #fdd;
}
#rel1 {
position: relative;
border: 1px dashed #996;
background-color: #cff;
margin: 0px 10px 0px 10px;
text-align: left;
}
ê²°ê³¼
See also
- Stacking without z-index : Default stacking rules
- Adding z-index : Using z-index to change default stacking
- The stacking context : Notes on the stacking context
- Stacking context example 1 : 2-level HTML hierarchy, z-index on the last level
- Stacking context example 2 : 2-level HTML hierarchy, z-index on all levels
- Stacking context example 3 : 3-level HTML hierarchy, z-index on the second level
Original Document Information
- Author(s): Paolo Lombardi
- This article is the english translation of an article I wrote in italian for YappY. I grant the right to share all the content under Creative Commons: Attribution-Sharealike license
- Last Updated Date: July 9th, 2005