아래 코드에 대해 두 가지 질문이 있습니다.
두 개의 오른쪽 div가 위로 이동하여 콘텐츠 div와 더 수직으로 정렬되지 않는 이유는 무엇입니까?
"맨 오른쪽"div가 완전히 옳지 않은 이유는 무엇입니까?
CSS
.container {width:800px;}
* {border:1px solid black;}
HTML
<div class="container">
<div>nav area</div>
<div style="width:500px;">Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</div>
<div style="float:right;width:100px;">
this is the side bar area
</div>
<div style="float:right;width:100px;">far right side</div>
<footer style="clear:both;">footer area</footer>
</div>
부동 요소의 순서가 중요합니다. Lorem Ipsum 콘텐츠 위에 있는 두 <div>
요소를 배치하면 세 가지 요소가 모두 수직으로 정렬됩니다.float: right
<div>
여러 요소 float: right
가있는 경우 두 요소 중 첫 번째 요소 가 가장 오른쪽에 있습니다. 순서를 바꾸려면 문서에서 순서를 반대로하십시오. 하나를 다른 것 아래에 표시하려면 먼저 높은 것을 주문하고 다른 하나를clear: right;
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다