2016-01-06 10 views

回答

2

最簡單的方法是使用負邊距。

.item-1 { 
 
\t width: 400px; 
 
\t height: 500px; 
 
\t background: grey; 
 
\t margin: 0 auto; 
 
} 
 

 
.item-2 { 
 
\t width: 300px; 
 
\t height: 100px; 
 
\t background: red; 
 
\t margin: -50px auto 0 auto; 
 
}
<div class="item item-1"></div> 
 
<div class="item item-2"></div>

相關問題