Maison > Article > interface Web > CSS3弹性盒模型_html/css_WEB-ITnose
弹性盒模型
<style> .box {height: 100px; border: 10px solid #000; padding: 10px; display: -webkit-box; -webkit-box-orient: vertical;} .box div {width: 100px; height: 100px; background:red; border: 1px solid #fff;}</style><body> <div class="box"> <div>1</div> <div>2</div> <div>3</div> </div></body>
<style> .box {height: 100px; border: 10px solid #000; padding: 10px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-direction: reverse;} .box div {width: 100px; height: 100px; background:red; border: 1px solid #fff;}</style><body> <div class="box"> <div>1</div> <div>2</div> <div>3</div> </div></body>
<style> .box {height: 100px; border: 10px solid #000; padding: 10px; display: -webkit-box; -webkit-box-orient: vertical;} .box div {width: 100px; height: 100px; background:red; border: 1px solid #fff;} .box div:nth-of-type(1) {-webkit-box-ordinal-group: 2;} .box div:nth-of-type(2) {-webkit-box-ordinal-group: 3;} .box div:nth-of-type(3) {-webkit-box-ordinal-group: 1;}</style><body> <div class="box"> <div>1</div> <div>2</div> <div>3</div> </div></body>
<style> .box {height: 100px; border: 10px solid #000; padding: 10px; display: -webkit-box; -webkit-box-orient: vertical;} .box div {width: 100px; height: 100px; background:red; border: 1px solid #fff;} .box div:nth-of-type(1) {-webkit-box-flex: 1;} .box div:nth-of-type(2) {-webkit-box-flex: 2;} .box div:nth-of-type(3) {-webkit-box-flex: 3;}</style><body> <div class="box"> <div>1</div> <div>2</div> <div>3</div> </div></body>
<style> .box {height: 100px; border: 10px solid #000; padding: 10px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-box-direction: reverse; -webkit-box-pack: end;} .box div {width: 100px; height: 100px; background:red; border: 1px solid #fff;}</style><body> <div class="box"> <div>1</div> <div>2</div> <div>3</div> </div></body>
<style> .box {width: 100px; height: 100px; margin: 100px; background: red; box-shadow: 10px 10px 30px blue;}</style><body> <div class="box"></div></body>
<style><br /> // reflect表示倒影和元素之间的距离 img { display: block; margin: 200px auto; -webkit-box-reflect: below 10px;}</style><body> <img src="" / alt="CSS3弹性盒模型_html/css_WEB-ITnose" ></body>
<style> // 水平方向上可以拖动 .box {width: 100px; height: 100px; background: url(1.png); border: 5px solid #000; resize: horizontal; overflow: auto;}</style><body> <div class="box"></div></body>