레이아웃을 이렇게 짜려면?

레이아웃을 이렇게 짜려면?

QA

레이아웃을 이렇게 짜려면?

본문

c89723d02c9f7b0c9cbfedee08ed8ad8_1422580968_5988.jpg

레이아웃을 이렇게 짜려면 CSS를 어떻게 하는것이 좋을까요?

이 질문에 댓글 쓰기 :

답변 3


<style>
div#wrapper {
 width:600px;
 margin:auto;
}
div#div1 {
 float:left;
 width:200px;
 height:400px;
 background:#F00;
}
div#div2 {
 float:left;
 width:200px;
 height:400px;  
}
div#div2_1 {
 float:left;
 width:200px;
 height:200px;
 background:#FF0;
}
div#div2_2 {
 float:left;
 width:200px;
 height:200px;
 background:#0F0;
}
div#div4 {
 float:left;
 width:200px;
 height:400px;
 background:#00F;
}
</style> 

<div id="wrapper">
    <div id="div1"></div>
    <div id="div2">
        <div id="div2_1"></div>
        <div id="div2_2"></div>
    </div>
    <div id="div4"></div>
</div>​

이렇게 구성하면 될 듯 합니다.

 

​일반적인 방법 2가지... 

입코딩이라 오류가 있을 수도...;;


공통스타일

 

<style>

.box {width:150px;height:300px}

.box-box {width:150px;height:150px}

#box1 {background:#8EC641}

#box2-1 {background:#f8931f}

#box2-2 {background:#ef3236}

#box3 {background:#55a8de}

</style>

 

공통마크업

 

<div id="wrap">

<div id="box1" class="box">1</div>

<div id="box2" class="box">

    <div id="box2-1" class="box-box">2</div>

    <div id="box2-2" class="box-box">3</div>

</div>

<div id="box3" class="box">4</div> 

</div>


1. float 을 이용하는 방법

 

<style>

#wrap:after {display:block;visibility:hidden;clear:both;content:""}

.box {float:left}

</style>

 

2. position:absolute 를 이용하는 방법

 

<style>

#wrap {height:300px}

.box {position:absolute;top:0}

#box1 {left:0}

#box2 {left:150px}

#box3 {left:300px}

</style>


<style type="text/css">
	#wrap{width:100%;height:auto;}
	#wrap .section01{width:33%;height:500px;float:left;background-color:green;}
	#wrap .middelSectionWrap{width:33%;height:500px;float:left;}
	#wrap .middelSectionWrap .section02{width:33%;height:250px;background-color:​orange;}
	#wrap .middelSectionWrap .section03{width:33%;height:250px;background-color:​red;}
	#wrap .section04{width:33%;height:500px;float:left;background-color:​blue;}
</style>
<div id="wrap">
	<div class="section01">1</div>
	<div class="middelSectionWrap">
		<div class="section02">2</div>
		<div class="section03">3</div>
	</div>
	<div class="section04">4</div>
</div> 
답변을 작성하시기 전에 로그인 해주세요.
전체 4,542
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT