?
This document uses PHP Chinese website manual Release
box-pack:start | center | end | justify
默認(rèn)值:start
適用于:伸縮盒容器
繼承性:無(wú)
動(dòng)畫(huà)性:否
計(jì)算值:指定值
start:設(shè)置伸縮盒對(duì)象的子元素從開(kāi)始位置對(duì)齊(大部分情況等同于左對(duì)齊,受)
center:設(shè)置伸縮盒對(duì)象的子元素居中對(duì)齊
end:設(shè)置伸縮盒對(duì)象的子元素從結(jié)束位置對(duì)齊(大部分情況等同于右對(duì)齊)
justify:設(shè)置或伸縮盒對(duì)象的子元素兩端對(duì)齊
效果等同于過(guò)渡版本的flex-pack屬性和新版本的justify-content屬性;
box-pack的對(duì)齊方式受box-orient影響;
默認(rèn)情況下(即box-orient設(shè)置為horizontal)start和end所呈現(xiàn)的效果等同于左對(duì)齊和右對(duì)齊;
當(dāng)box-orient設(shè)置為vertical時(shí),start和end所呈現(xiàn)的效果等同于頂部對(duì)齊和底部對(duì)齊;
對(duì)應(yīng)的腳本特性為boxPack。
Values | IE | Firefox | Chrome | Safari | Opera | iOS Safari | Android Browser | Android Chrome |
---|---|---|---|---|---|---|---|---|
Basic Support | 6.0-11.0 | 2.0-40.0-moz-#1 | 4.0-45.0-webkit- | 6.0-8.0-webkit- | 15.0-29.0-webkit- | 6.0-8.3-webkit- | 2.1-4.4.4-webkit- | 18.0-42.0-webkit- |
支持justify
值但無(wú)效果。
<!DOCTYPE html> <html lang="zh-cmn-Hans"> <head> <meta charset="utf-8" /> <title>box-pack_CSS參考手冊(cè)_web前端開(kāi)發(fā)參考手冊(cè)系列</title> <meta name="author" content="Joy Du(飄零霧雨), dooyoe@gmail.com, www.doyoe.com" /> <style> h1{font:bold 20px/1.5 georgia,simsun,sans-serif;} .box,.box2{display:-webkit-box;display:-moz-box;display:-ms-box;margin:0;padding:10px;background:#000;list-style:none;} .box{-webkit-box-orient:horizontal;-moz-box-orient:horizontal;-ms-box-orient:horizontal;width:260px;height:100px;} .box2{-webkit-box-orient:vertical;-moz-box-orient:vertical;-ms-box-orient:vertical;width:100px;height:260px;} #box,#box5{-webkit-box-pack:start;-moz-box-pack:start;-ms-box-pack:start;} #box2,#box6{-webkit-box-pack:center;-moz-box-pack:center;-ms-box-pack:center;} #box3,#box7{-webkit-box-pack:end;-moz-box-pack:end;-ms-box-pack:end;} #box4,#box8{-webkit-box-pack:justify;-moz-box-pack:justify;-ms-box-pack:justify;} .box li{width:50px;} .box2 li{height:50px;} .box li:nth-child(1),.box2 li:nth-child(1){background:#666;} .box li:nth-child(2),.box2 li:nth-child(2){background:#999;} .box li:nth-child(3),.box2 li:nth-child(3){background:#ccc;} </style> </head> <body> <h1>橫向排列時(shí)子元素從起始位置對(duì)齊 box-pack:start;</h1> <ul id="box" class="box"> <li>1</li> <li>2</li> <li>3</li> </ul> <h1>橫向排列時(shí)子元素居中對(duì)齊 box-pack:center;</h1> <ul id="box2" class="box"> <li>1</li> <li>2</li> <li>3</li> </ul> <h1>橫向排列時(shí)子元素從結(jié)束位置對(duì)齊 box-pack:end;</h1> <ul id="box3" class="box"> <li>1</li> <li>2</li> <li>3</li> </ul> <h1>橫向排列時(shí)子元素兩端對(duì)齊 box-pack:justify;</h1> <ul id="box4" class="box"> <li>1</li> <li>2</li> <li>3</li> </ul> <h1>縱向排列時(shí)子元素從起始位置對(duì)齊 box-pack:start;</h1> <ul id="box5" class="box2"> <li>1</li> <li>2</li> <li>3</li> </ul> <h1>縱向排列時(shí)子元素居中對(duì)齊 box-pack:center;</h1> <ul id="box6" class="box2"> <li>1</li> <li>2</li> <li>3</li> </ul> <h1>縱向排列時(shí)子元素從結(jié)束位置對(duì)齊 box-pack:end;</h1> <ul id="box7" class="box2"> <li>1</li> <li>2</li> <li>3</li> </ul> <h1>縱向排列時(shí)子元素兩端對(duì)齊 box-pack:justify;</h1> <ul id="box8" class="box2"> <li>1</li> <li>2</li> <li>3</li> </ul> </body> </html>
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例