In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article is about whether span is a block element in html. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
In html, span is not a block element, but an inline element (inline element). span element is mainly used to accommodate text, multiple span elements can be displayed in a line; and the width and height of span elements are determined by the content, and cannot be set with width and height attributes. The block element is exclusive to a row, and the width and height can be set.
Operating environment of this tutorial: Windows 7 system, HTML5 version, Dell G3 computer.
span is not a block element, but an inline element (inline element) that is primarily used to hold text. span It only defines the content as a whole for operation, without affecting the layout and display.
Examples:
span { width: 100px; height: 100px; } Hello. Hello.
It can be seen that multiple span elements can be displayed on a single line; and the width and height of span elements are determined by the content contained, and the width and height attributes cannot be set. And these are the characteristics of inline elements.
block-level element
The display attribute of a block-level element is usually block. Why is it usually said? Because the display attribute of li is list-item, and the display attribute of table is table, but they are both block-level elements.
Characteristics of block-level elements
Block level elements have one row
You can set the width, height, row height, margin, and padding of an element
A block-level element occupies the entire space of its parent element (container).
Can accommodate inline elements and other block elements
Why should block-level elements have a row to themselves? Because the width of a block-level element fills the width of its parent element, there is no room to display other elements, only a separate row.
Common block-level elements are:
~
inline elements
The display attribute of an inline element is: inline
Characteristics of Inline Elements
and other inline elements are displayed side by side on one line;
Element width and height cannot be set, but row height can be set line-height
The width of an element is the width of the text or image it contains and cannot be changed.
An inline element can only hold text or other inline elements
The horizontal outer margin can be set for in-line elements, but the vertical direction cannot be set. The horizontal and vertical padding can be set.
Common inline element elements:
Thank you for reading! About "html span is not a block element" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.