CSS 屬性 display 取值 box 和 flexbox 以及 flex 有什麼不同,分別表示什麼?

時間 2021-05-05 16:31:45

1樓:

除了firefox,chrome safari opera 等瀏覽器對舊版支援已經很好了,舊版就是display: -webkit-box/-moz-box/box;混合版本是針對IE10的,display:-ms-flexbox;還有現代版,display:

flex。

2樓:一絲

瀉藥。這種 Google 一下就能找到的問題真心不建議來知乎提問。

不同的寫法是對應不同時期的 Flex 規範,強烈建議使用 autoprefixer 自動增加字首,在開發的時候只寫標準屬性「display:flex」,然後通過外掛程式自動生成字首。

各個寫法的相容性如下:

.foo

3樓:黑貓

"Old" Flexbox and "New" Flexbox

If you Google around about Flexbox, you will find lots of outdated information.Here's how you can quickly tell:

If you are looking at a blog post (or whatever) about Flexbox and you see display: box; or a property that is box-, you are looking at the old 2009 version of Flexbox.

If you are looking at a blog post (or whatever) about Flexbox and you see display: flexbox; or the flex() function, you are looking at an awkward tweener phase in 2011.

If you are looking at a blog post (or whatever) about Flexbox and you see display: flex; and flex- properties, you are looking at the current (as of this writing) specification.

很好懂就不翻譯了。

CSS 裡的 height 屬性與 line height 屬性有什麼區別?

木林森 看 精通CSS 4.4節的時候碰到這個問題 作者使用line height而不是height控制高度,達到了文字垂直居中的目的,這是因為 行高還有乙個特性,叫做垂直居中性 css行高line height的一些深入理解及應用張鑫旭 height表示垂直高度,line height表示文字行高...

CSS 那麼多屬性,而且每個屬性都有多個值怎麼記?

Ian Liu 難得是不知道要用那個屬性,CSS的不正交性導致同乙個屬性在不同組合中呈現的效果還不同,再加瀏覽器差異,版本差異,弄在一起就是亂麻。 水魚 css屬性屬性值確實比較多,其實你不用死記硬背,不知道你這邊是自學還是有老師教,如果有老師教得話會輕鬆些,跟著老師的思路走,課下多練習案例即可,如...

CSS 中已設定的屬性怎麼去掉

只能覆蓋,不能改原始檔。這個要求有點坑 方案 1 寫自己的樣式,不過要放在原樣式的後面 不管你是引入方式,還是頁內方式 2 用js,來設定樣式 注意 如果是定位,需要先吧之前的left top 等給重寫一下預設值,要不然之前寫的和現在寫的都會唄解析 還在學習的小白乙個,今天也遇到了這個問題,前面大神...