在“何时使用显示器:块何时:在线和何时:在线块”中是否有任何指南。为什么? [英] Is there any guide on "When to use display:block when :inline and when :inline-block" and why?

查看:83
本文介绍了在“何时使用显示器:块何时:在线和何时:在线块”中是否有任何指南。为什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

: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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆