在“何时使用显示器:块何时:在线和何时:在线块”中是否有任何指南。为什么? [英] Is there any guide on "When to use display:block when :inline and when :inline-block" and why?
问题描述
当:inline
和<$时,你知道有关何时使用 display:block
c $ c>:inline-block 为什么?
Do you know any good article on "When to use display:block
when :inline
and when :inline-block
" and why?
,当我们必须重写显示:?通过css为任何HTML标签/元素?
and when we will have to override display:?? through css for any HTML tag/element?
推荐答案
inline
该元素好像是一个内联的文本块。 width
和 height
没有意义。
inline
- Treats the element as though it were an inline chunk of text. width
and height
are meaningless
block
- 将元素视为矩形。 width
和 height
可以指定
block
- Treats the element as as rectangle. width
and height
can be specified
inline-block
- 流动一个与文本内联的元素,但允许 width
和 height
指定。
inline-block
- Flows a element inline with the text, but allows width
and height
to be specified.
元素默认为其中一个。例如:
Elements default to one of these anyway. For example:
< span>
,< em>
,< strong>
- > inline
< div>
,< p>
- > $ c>
<div>
, <p>
-> block
这篇关于在“何时使用显示器:块何时:在线和何时:在线块”中是否有任何指南。为什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!