index
.container {
width: 500px;
background: #0099ff;
margin: 0 auto;
}
.container .item {
background: #00ffa2;
color: #d32a2a;
text-align: center;
font-size: 36px;
margin-bottom: 10px;
}
.container .item1 {
height: 150px;
width: 150px;
}
.container .item2 {
height: 200px;
width: auto;
//因為沒設定寬度,所以會自適應延伸父元素,
//父元素寬多少ex:500px,子元素寬就會多少ex:500px
}
.container .item3 {
height: auto;
width: 400px;
}