This time I will show you how to set the width attribute for the span tag style, and what are the precautions for setting the width attribute for the span tag style. The following is a practical case, let's take a look. Set the width attribute directly to the span tag style, and you will find that it will not have any effect.
If
display
:block is set, the width attribute takes effect, but the span at this time is the same as the div. If display:inline-block is set, the spans will be listed in the same row, and the width attribute will take effect.
Common value descriptions of element display attribute:
1) block: The default value of block
object
. Forces the object to be rendered as a block object, adding a new line after the object. 2) inline: the default value of inline objects. Forces the object to be rendered as an inline object, removing
lines from the object. 3) inline-block: Render the object as an inline object, but the content of the object is rendered as a block object. Adjacent inline objects will be rendered on the same line. 4) non: hidden object. Unlike the hidden value of the
visibility
property, it does not reserve its physical space for hidden objects. I believe you have mastered the methods after reading these cases. For more exciting information, please pay attention to other related articles on the php Chinese website!
Related reading:
How to set the border and transparency style of DivHow to operate the subpage of iframe to block the parent page Pop-up layer effectHow to use the meta viewport attribute of HTMLHow to modify the default submission method of the formThe above is the detailed content of How to set the width attribute for span tag style. For more information, please follow other related articles on the PHP Chinese website!