External style? Inline style? Internal style sheets? Differences

Source: Internet
Author: User
External style sheet

When a style needs to be applied to many pages, the external style sheet is ideal. When using an external style sheet, you can change the appearance of the entire site by changing a file. Use the <link> label to link to the style sheet on each page. <Link> tag in (document) header:

<Head> <linkRel = "stylesheet" type = "text/CSS" href ="mystyle.css"/> </Head>


Internal style sheet

When a document requires a special style, you should use an internal style sheet. You can use the <style> label to define an internal style sheet in the Document Header, as shown in the following figure:

<style type="text/css">  hr {color: sienna;}  p {margin-left: 20px;}  body {background-image: url("images/back40.gif");}</style>
Inline Style

Because we need to mix the performance and content together, inline styles will lose many of the advantages of style sheets. Use this method with caution. For example, when a style only needs to be applied once on one element.

To use inline Styles, you must use the style attribute in the relevant labels. The style attribute can contain any CSS attribute. This example shows how to change the color and left margin of a paragraph:

<Pstyle= "Color: Sienna; margin-left: 20px"> This is a paragraph </P>

Priority:
Inline> embedded> external reference
Thanks to http://www.howzhi.com/group/web-dev/discuss/11096's sharing.

External style? Inline style? Internal style sheets? Differences

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.