Div, span, divspan

Source: Internet
Author: User

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.

  

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.