display:inline vs display:block [英] display:inline vs display:block

查看:163
本文介绍了display:inline vs display:block的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个CSS的基本区别:

  display:inline 



和这个?

  display:block` $使用这些单独的元素,我得到相同的结果。

$ b

display:block 表示元素显示为块,因为段落和标头总是存在。一个块在它上面和下面有一些空格,除了在另外排序的时候(例如通过向另一个元素添加一个float声明),它不允许在其旁边的HTML元素。



display:inline 表示元素在同一行上的当前块内内联显示。



阅读更多有关显示选项的信息:​​ http://www.quirksmode.org/css/display.html


What is the basic difference between this CSS:

display:inline

and this?

display:block`

Using these separately on an element, I get the same result.

解决方案

display: block means that the element is displayed as a block, as paragraphs and headers have always been. A block has some whitespace above and below it and tolerates no HTML elements next to it, except when ordered otherwise (by adding a float declaration to another element, for instance).

display: inline means that the element is displayed inline, inside the current block on the same line. Only when it's between two blocks does the element form an 'anonymous block', that however has the smallest possible width.

Read more about display options : http://www.quirksmode.org/css/display.html

这篇关于display:inline vs display:block的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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