Use external CSS

Source: Internet
Author: User
Document directory
  • What's external CSS
  • Example
  • Why use external CSS file?
Quoted from http://www.tizag.com/cssT/external.php
What's external CSS

When using CSS it is preferable to keep the CSS separate from your HTML. placing CSS in a separate file allows the web designer to completely differentiate between content (HTML) and design (CSS ). external CSS is a file that contains only CSS Code and is saved with ". CSS "file extension. this CSS file is then referenced in your HTML using the <link>InsteadOf <style>. If you're confused, don't worry. We are going to walk you through the whole process.
Example

This is a HTML file named index.html: 1 <HTML>
2
3 <LINK rel = "stylesheet" type = "text/CSS" href = "test.css"/>
4
5 <body>
6 7 <p> This paragraph has a blue font.
8 The background color of this page is gray because
9 we changed it with CSS! </P>
10 </body>
11

Make sure save this file as "index.html" (without the quotes) in the same directory as your CSS file.

Why use external CSS file?
  1. It keeps your website design and content separate.
  2. It's much easier to reuse your CSS code if you have it in a separate file. instead of typing the same CSS code on every web page you have, simply have pages refer to a single CSS file with the "Link" tag.
  3. You can make drastic changes to your web pages with just a few changes in a single CSS file.

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.