2015-03-25 70 views

回答

0

這是什麼東西,可以幫助。 http://jsfiddle.net/mf36nLrt/

.photo, .div3{ 
 
    width: 75px; 
 
    height: 90px; 
 
    border: 1px solid #d5d5d5; 
 
    float: left; 
 
} 
 

 
.div1, .div2, .hr, .div4 { 
 
    float: left; 
 
    width: calc(100% - 85px); /* Here 85 is the width of PHOTO + margin + border */ 
 
    margin-left: 5px; /*Adjust this value for the space between photo and DIV#1 */ 
 
    border: 1px solid #d5d5d5; 
 
    height: 50px; 
 
} 
 

 
.hr{ 
 
    border: none; 
 
    border-bottom: 1px solid #d5d5d5; 
 
    margin-top: 5px; 
 
    height: 0px; 
 
} 
 

 
.div2{ 
 
    margin-top: 5px; 
 
    height: 30px; 
 
} 
 

 
.div3{ 
 
    margin-top: 5px;  
 
} 
 

 
.div4{ 
 
    height: 90px; 
 
    margin-top: 5px; 
 
}
<div> 
 
    <div> 
 
     <div class="photo"></div> 
 
     <div class="div1"></div> 
 
     <div class="hr"></div> 
 
     <div class="div2"></div> 
 
    </div> 
 
    <div> 
 
     <div class="div3"></div> 
 
     <div class="div4"></div> 
 
    </div> 
 
</div>

0

要麼給多規格,或在這裏它是:

.left { 
 
    max-width: 150px; 
 
    background-color: red; 
 
    display: inline-block; 
 
    vertical-align: top; 
 
    } 
 
    .right { 
 
    background-color: blue; 
 
    display: inline-block; 
 
    vertical-align: top; 
 
    }
<div class="page"> 
 
    <div class="left"> 
 
    <div style="border:1px solid black; margin-bottom:5px;">Photo</div> 
 
    <div style="border:1px solid black; ">Div 3</div> 
 
    </div> 
 
    <div class="right"> 
 
    <div style="border:1px solid black; margin-bottom:5px;">Div 1</div> 
 
    <hr> 
 
    <div style="border:1px solid black;">Div 2</div> 
 
    <div style="border:1px solid black;">Div 4</div> 
 
    </div> 
 
</div>

+0

聯樣式 - *** ***真的? – jbutler483 2015-03-25 11:14:07

+0

你有什麼反對嗎? – Alexey 2015-03-25 11:32:55

+0

[這只是幾個原因...](http://stackoverflow.com/questions/2612483/whats-so-bad-about-in-line-css)但等,[似乎還有幾個原因這裏...](http://robertnyman.com/2008/11/20/why-inline-css-and-javascript-code-is-such-a-bad-thing/)。等一下,[我也可以這樣做](http://bit.ly/1xy9ZAW) – jbutler483 2015-03-25 11:50:01