Files
freeCodeCamp/guide/chinese/css/layout/display-property/index.md
2018-10-16 21:32:40 +05:30

48 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: Display Property
localeTitle: 显示属性
---
## 显示属性
`display`属性指定用于HTML元素的框的类型。共有20个关键字值但通常只使用10个。常用的是
```css
.none {display: none}
.block {display: block}
.inline-block {display: inline-block}
.inline {display: inline}
.flex {display: flex}
.inline-flex {display: inline-flex}
.inline-table {display: inline-table}
.table {display: table}
.inherit {display: inherit}
.initial {display: initial}
```
**常见例子:**
```css
.myBox {
display: block;
}
.myContainer {
display: flex;
}
.inlineList ul > li {
display: inline;
}
```
#### 更多信息:
* 文档和关键字值的完整列表: [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/display)
* 有关显示属性的W3Schools CSS参考资料 [W3Schools](https://www.w3schools.com/cssref/pr_class_display.asp)
* CSS-TRICKS对display属性有很好的参考 [CSS-Tricks](https://css-tricks.com/almanac/properties/d/display/)
* 浏览器支持: [caniuse](http://caniuse.com/#search=display)
* Flexbox完整指南 [CSS-Tricks](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)