Home  >  Article  >  Web Front-end  >  How to set the width attribute for span tag style

How to set the width attribute for span tag style

php中世界最好的语言
php中世界最好的语言Original
2018-02-07 09:55:463529browse

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 Div


How to operate the subpage of iframe to block the parent page Pop-up layer effect


How to use the meta viewport attribute of HTML


How to modify the default submission method of the form

The 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn