당신 절대 및 상대적 CSS 위치 지정을 사용하여 일종의 제약 시스템을 생성 할 수 있습니다. 이 HTML을 감안할 때
:
<ul>
<li>
<div class="left">Left content</div>
<div class="center">Really long center content that will get truncated if you were to resize the window</div>
<div class="right">Right content</div>
</li>
</ul>
부모합니다 (li
)이 상대적으로 위치하는 경우, 당신은 left
/right
/width
및 top
/bottom
사용하여 어린이합니다 (div
요소)에 절대 위치를 사용할 수 있습니다/height
. 다음은 예입니다.
ul li {
position: relative; /* Parent has relative positioning */
}
ul li div {
position: absolute; /* Children have absolute positioning */
}
ul li .left {
left: 0; /* The left div should be all the way to the left */
width: 100px; /* Static width of the left section */
}
ul li .right {
right: 0; /* The right div should be all the way to the right */
width: 100px; /* Static width of the right section */
}
ul li .center {
left: 100px; /* Static width of the left section */
right: 100px; /* Static width of the right section */
}
이 예제는 http://jsfiddle.net/69TVf/1/에 게시했습니다.
너는'width : 80 %'와 비슷한 것을 사용할 수있다. – Virendra