Setting the width of inline elements

后端 未结 7 1256
悲&欢浪女
悲&欢浪女 2020-11-22 05:28

You can set the width of inline elements like , and , but you won’t notice any eff

7条回答
  •  时光取名叫无心
    2020-11-22 05:59

    As others have mentioned, setting the width (or some other position-related property) of an inline element will cause the browser to then display the element as a block element.

    You can explicitly declare this sort of behavior through using the CSS display property. The most common settings are display: inline (default), display: block, and display: none.
    A full reference for the display property is available here.

    However, it should be noted that the HTML 4.01 specification discourages the use of "overriding the conventional interpretation of HTML elements":

    Style sheets provide the means to specify the rendering of arbitrary elements, including whether an element is rendered as block or inline. In some cases, such as an inline style for list elements, this may be appropriate, but generally speaking, authors are discouraged from overriding the conventional interpretation of HTML elements in this way.

提交回复
热议问题