2017-01-23 63 views
-1

我正在使用flexbox构建表格,并且遇到了对齐问题。我希望能够将我的内容与右侧对齐,但我的标题居中。根据父标题将内容向右对齐

____________ 
| Test | 
|----------| 
|  $1 | 
|----------| 
| $312 | 
|----------| 

这里有一个例子结构,我有JSfiddle,任何想法我怎么能做到这一点使用Flexbox的?

回答

0

https://jsfiddle.net/04Lzxqun/2/ 删除 display:flex; justify-content:flex-end; 从 .Parent DIV

.table{ 
    display: flex; 
    flex-direction: row; 
} 
.parent{ 
    flex-direction: column; 
    border: 1px solid black; 
    flex-basis: 1 0 50px; 
    width: 100%; 
} 

.parent div { 
    border: 1px solid black; 
} 
.parent span{ 
    text-align: left !important; 
} 
.parent .header{ 
    text-align: center !important; 
} 

.header { 
    background-color: blue; 
} 

.empty{ 
    visibility: hidden; 
} 
+0

谢谢,但它不是我问 – CanIHazCookieNow