Div, span, divspan
1. Html block elements
HTML can combine elements through <div> and <span>
Most HTML elements are definedBlock-level elementsOrInline Element,
When a block-level element is displayed in a browser, it usually starts (or ends) with a new line ). For example:
Inline elements are usually not displayed starting with a new line. For example: <B>, <td>, <a>,
2. <div> element
An HTML <div> element is a block-level element. It is a container that can be used to combine other HTML elements.
<Div> the element has no specific meaning. In addition, because it is a block-level element, the browser will display a line before and after it.
If used with CSS, the <div> element can be used to set style attributes for Large content blocks.
<Div> another common purpose of an element is document layout. It replaces the old-fashioned method of defining la s using tables. Using the <table> element for document layout is not the correct usage of the table. <Table> an element is used to display tabular data.
By default, browsers usually place a line break before and after the <div> element.. (You can change this situation through css.
1. Set float
Set the float: left style to move the div object to the left, so that the div will lose its own width style.
1 <! DOCTYPE html> 2
2. Set the display style
Set the display: inline style to make the div lose the width of the default 100% exclusive row
Display: inline (display objects side by side)
1 <! DOCTYPE html> 2
)
2.1 attributes
| Attribute |
Value |
Description |
| Align |
Left Right Center Justify |
Not supported in html5 |
3. <span> Elements
<Span> an element is an inline element. It can be used as a text container and has no specific meaning. When used with CSS, the <span> element can be used to set style attributes for some texts.
3.1 Description
<Span> used to combine the line elements in the document.
<Span> labels do not have a fixed format. When a style is applied to it, it will produce visual changes. If you do not apply a style to the <span> element, the text in the <span> element is not visually different from other texts.
<Span> a tag provides a way to separate a part of the text or a part of the document.