2015-08-22 60 views

回答

1

.wrapper { 
 
    background: grey; 
 
    height: 280px; 
 
    width: 280px; 
 
} 
 
p { 
 
    vertical-align: middle; 
 
} 
 
#one { 
 
    background: blue; 
 
    float: left; 
 
    width: 140px; 
 
    height:140px; 
 
    text-align: center; 
 
    
 
} 
 
#two { 
 
    background: pink; 
 
    float: right; 
 
    width: 140px; 
 
    height:200px; 
 
    text-align: center; 
 
} 
 
#three { 
 
    background: aqua; 
 
    float: left; 
 
    width: 140px; 
 
    height:140px; 
 
    text-align: center; 
 
} 
 
#four { 
 
    background: green; 
 
    float: right; 
 
    width: 140px; 
 
    height:80px; 
 
    text-align: center; 
 
}
<html> 
 
<body> 
 
<div class="wrapper"> 
 
<div id="one"><p>TEXT</p></div> 
 
<div id="two"><p>TEXT</p></div> 
 
<div id="three"><p>TEXT</p></div> 
 
<div id="four"><p>TEXT</p></div> 
 
</div> 
 
</body> 
 
</html>

0

您可以使用一个表达到您想要的功能通过以下方式

table { 
 
    width: 50%; 
 
    border-collapse: collapse; 
 
    margin: auto; 
 
} 
 
tr > td { 
 
    width: 50%; 
 
    text-align: center; 
 
    padding: 3px; 
 
    vertical-align: top; 
 
}
<table> 
 
    <tr> 
 
    <td style="background: lightblue;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Laudantium, officiis facere dignissimos saepe voluptates, porro itaque eveniet reiciendis eius perferendis?</td> 
 
    <td style="background: pink">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Maiores asperiores inventore eveniet quas praesentium, dignissimos cum omnis architecto</td> 
 
    </tr> 
 
    <tr> 
 
    <td style="background: royalblue;">Lorem ipsum dolor inventore libero qui explicabo ea incidunt maxime blanditiis assumenda? Iusto, at ipsam eveniet!</td> 
 
    <td style="background: cyan;">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusantium quis, quo ea est nostrum veniam?</td> 
 
    </tr> 
 
</table>