Getting started with CSS

Source: Internet
Author: User
Document directory
  • Example of getting started with CSS -- try editing
2. Getting started with CSS

You can use this link to get started with HTML.

Example of getting started with CSS -- try editing
  • Define text color
  • Define the background color of a webpage
  • Define the background image of a webpage
  • Define text alignment
  • Custom list Style
  • Set your mouse Style
  • Define a colored border

 

Through the above example, do you have a feeling? Start learning from scratch now :)

<1> open notepad: click "start" -- select "program" -- select "attachment" -- select "Notepad" (or open your editplus editor)

<2> enter the following code (copy the Code directly)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><title>Welcome to the dream capital</title><link rel="stylesheet" type="text/css" href="dreamdu.css" /><body>Welcome to the dream capital<p>This is my first webpage.<a href="http://www.dreamdu.com/css/">Learn CSS</a>Right!</p></body>

Click "file" -- select "save" -- select "all files" as the file type -- Enter "dreamdu.html" as the file name and select the file storage address. (You must save the file suffix as. HTML or. htm. Otherwise, the page cannot be displayed)

<3> Create another file and enter the following code (copy it directly)

/* Paragraph style */p{color: purple;font-size: 12px;}/* Title style */h1{color: olive;text-decoration: underline;}/* Link style */a:link{color:#006486;}a:visited{ color:#464646;}a:hover { color: #fff;background: #3080CB;}a:active { color:white;background: #3080CB ;}

Click "file" -- select "save" -- select the file type as "all files" -- input "dreamdu.css" in the file name and select the file storage address. (The suffix of the file must be saved as. CSS, and be in the same directory as dreamdu.html .)

<4> now we can double-click the dreamdu.html file to see the effect.

How is it? Colorful :)

Now let's explain the above example.

An HTML file is a text file. an HTML file must be loaded at the head.CSSStyle<link rel="stylesheet" type="text/css" href="dreamdu.css" />.

CSSThe file is also a text file.

p{color: purple;font-size: 12px;}

Indicates that all content contained in the p tag is purple-red.color: purple;, 12px sizefont-size: 12px;.

h1{color: olive;text-decoration: underline;}

Indicates that the content contained in the H1 tag is Olivecolor: olive;, Underlinedtext-decoration: underline;.

a:link{color:#006486;}a:visited{ color:#464646;}a:hover { color: #fff;background: #3080CB;}a:active { color:white;background: #3080CB ;}

It represents the HTML link style, which is a bit complicated. You can check the effect first, in the advanced tutorial, I will analyze the link style (this link style is used by mengzhidu). [For details, refer to http://www.dreamdu.com/style.css].

Several Questions

For example, what editor does it use? For more information about how to display the extension, see the example of HTML and XHTML.

From: http://www.dreamdu.com/css/declaration/

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.