Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the intra-line elements and intra-block elements in html

2025-02-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the html in the line elements and block elements are which, have a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian with you to understand.

Characteristics of HTML inline elements (inlineelement):

Inline elements are also called inline elements or embedded elements. Inline elements and other elements are on one line, and the height, row height, inner and outer margins are immutable. The width is the width of its text or picture, and it is also unchangeable. Inline elements can only hold text or other inline elements.

As mentioned in the previous article, a _ is an inline element.

Characteristics of block level (block) elements:

① always starts on a new line.

② height, row height, outer and inner margins can be controlled.

The width of ③ defaults to 100% of its container unless a width is set

④ it can hold inline elements and other block elements.

Characteristics of inline (inline) elements:

① and other elements are on one line

② height, row height, outer and inner margins are unchangeable

The width of ③ is the width of its text or picture, which cannot be changed.

④ inline elements can only hold text or other inline elements.

Description of inline and block elements:

According to the CSS specification, every web element has a display attribute, which is used to determine the type of the element. Each element has a default display attribute value, such as the div element, whose default display attribute value is "block" and becomes a "block-level" element (block-level), while the default display attribute value of the span element is "inline", which is called the "inline" element. Block-level elements such as div will automatically occupy a certain rectangular space, and you can adjust the appearance of this rectangle by setting attributes such as height, width, and internal and external margins; on the contrary, inline elements like "span"a" have no independent space of their own, it is dependent on other block-level elements, therefore, it is invalid to set attributes such as height, width, and inner and outer margins on inline elements.

Differences between inline and block elements:

(1)。 A block-level element has an exclusive row, and its width automatically fills the width of its parent element

The elements in the line will not occupy a single line, and the adjacent elements in the line will be arranged in the same line. The line will not be wrapped until the line cannot be lined up, and its width varies with the content of the element.

(2)。 In general, the width,height attribute can be set for block-level elements, but the width,height setting for inline elements is invalid.

(note: even if the width of block-level elements is set, they still occupy a single line.)

(3)。 Block-level elements can be set to margin and padding. Horizontal padding-left,padding-right,margin-left,margin-right of inline elements produces a margin effect, but vertical padding-top,padding-bottom,margin-top,margin-bottom does not produce a margin effect. (horizontal direction is valid, vertical direction is invalid)

What are the row elements and block elements, respectively:

Block element (blockelement)

Address- address

Blockquote- block referenc

Align blocks in center- lift

Dir- directory list

Div- is commonly used at the block level and is also the main tag of csslayout.

Dl- definition list

Fieldset-form control group

Form- interactive form

H2-headline

H3-subtitle

H4-3 level title

H5-4 level title

H6-5 level title

H7-6 level title

Hr- horizontal separator

Menu- menu list

Noframes-frames optional content, (display this block content for browsers that do not support frame

Noscript- optional script content (displayed for browsers that do not support script)

Ol- sort form

P-paragraph

Pre- formatted text

Able- form

Ul- unsorted list

Inline element (inlineelement) (inline element)

A-anchor point

Abbr- abbreviation

Acronym- initials

B-bold (not recommended)

Big- big font

Br- line wrapping

Cite- reference

Code- computer code (required when referencing source code)

Dfn- definition field

Em- emphasizes

Font- font settings (not recommended)

I-italic

Img- Picture

Input- input box

Kbd- defines keyboard text

Label- form label

Q-short reference

S-underlined (not recommended)

Samp- defines sample computer code

Select- project selection

Small- small font text

Span- commonly used inline containers to define blocks within the text

Dash in strike-

Strong- emphasizes in bold

Sub- subscript

Sup- superscript

Textarea- multiline text input box

Tt- telex text

U-underline

Var- defines variables

Thank you for reading this article carefully. I hope the article "what are the in-line elements and in-block elements in html" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report