How to write CSS

Source: Internet
Author: User
Tags format
CSS in the example above, we can see that the CSS statements are embedded inside the HTML document. So the way to write CSS is the same as the way you write HTML documents.


you can write with any kind of text editing tool. For example, Notepad and WordPad under Windows, specialized HTML text editing tools (Frontpage, UltraEdit, and so on) can be used to edit CSS documents.


so you might ask, how can a standalone edited CSS document be added to an HTML document? In fact, two methods have been introduced in the example in the first chapter.


a CSS document into a <head> document:


<style type= "Text/css" > ... </style>


"Type= ' text/css" in <style> means that the code in <style> defines the style form.


Another way is to write a CSS stylesheet in the line of HTML, such as the following code:


<p style= "Font-size:14pt;color:blue" > Blue No. 14th Text </p>


This is to use the <style= "" > Format to write the style in any line in the HTML, which is more convenient and flexible. Another way to do this is to save your edited CSS document as ". CSS file, and then defined in <head>. The format of the definition is this:


<head> <link rel=stylesheet href= "Style.css" > ... </head>


we see a <link&gt applied here, and "rel=stylesheet" means that the connected element is a style sheet (stylesheet) document. This is generally not required to change.


and the "href= ' style.css" refers to the address of the file that needs to be connected. All you need to do is edit it. " CSS "The detailed path name of the file can be written in." This approach is ideal for defining multiple documents at once. It enables multiple documents to use the same style at the same time, thereby reducing a lot of redundant code.

This chapter mainly introduces the method of writing CSS and how to combine the CSS document with HTML to use. You can choose which method to combine CSS according to the structure and length of the HTML code you write.
In the next chapter we will go into the specific knowledge of CSS learning, we will start with the most basic attributes begin.







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.