Div, span, and center elements in style sheet CSS

Source: Internet
Author: User
css| style Sheet

<div> and <span> use to specify a style or binding script for the content. Although most HTML elements can set style information through the Style property, many HTML elements have their own default styles that might mix and even conflict with style-defined styles that we don't want to see. such as: <strong style = "color:red" >i am strong!</strong>. Unlike other HTML elements,,<div> and <span> do not have a default display style. So you can use them to specify the style.

(1) <div> (division) is a block-level element that can contain paragraphs, headings, tables, and even chapters, summaries, and notes. Because it is a block-level element, a newline is inserted at the beginning and end of the paragraph. <div align= "" >...</div> is used to set the location of the content block. You can use <div> to bind scripts or styles to any part of a document.

(2) and <div> different,<span> is an inline element that does not cause a newline. It is a logical, inline grouping element. The most common way to use it is to specify a style for several words or even a few characters in a paragraph of text.

(3) You can place the content that needs to be centered in the middle of <center></center>. <center> is the same as <div align = "center" > function.

Examples of the use of:<span> elements.

<p>in this sentence <span class = "Important" >some of the ' text is ' important!</span></p>



Related Article

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.