Basic CSS instances

Source: Internet
Author: User

Original tutorial. For more information, see Webpage Tutorial.
We now need to use CSS for designing web pages. In this tutorial, we will teach you how to use CSS in the form of examples. We will use four examples to illustrate how to use CSS! The four examples in this tutorial help you understand when CSS works after adding CSS to HTML? And how to display it without adding CSS. Arouse your interest in CSS learning.
First, create a CSS file, open our notepad, and enter the following content:
P
{
Color: # ff0000;
Background: transparent;
}
Save it as style1.css (in this CSS file, we define the style of the p tag as red and the background is transparent)
Instance 1: save the following file as a. HTM file, and save it in the same directory as style1.css.

The code is as follows: Copy code
<Html>
<Head>
<Title> tutorial 1 on web tutorial network </title>
<Link href = "style1.css" rel = "stylesheet" type = "text/css"/>
<Style type = "text/css">
P
{
Color: #00ff00;
Background: transparent;
}
</Style>
</Head>
<Body>
<P style = "color: # 0000ff; background: transparent;"> blue text display </p>
</Body>
</Html>

Instance 2:

The code is as follows: Copy code
<Html>
<Head>
<Title> CSS instance 2 of Webpage Tutorial network </title>
<Link href = "style1.css" rel = "stylesheet" type = "text/css"/>
<Style type = "text/css">
P
{
Color: #00ff00;
Background: transparent;
}
</Style>
</Head>
<Body>
<P> Green text display </p>
</Body>
</Html>

Instance 3:

The code is as follows: Copy code
<Html>
<Head>
<Title> CSS instance 3 of Webpage Tutorial network </title>
<Link href = "style1.css" rel = "stylesheet" type = "text/css"/>
</Head>
<Body>
<P> red text display </p>
</Body>
</Html>

Instance 4:

The code is as follows: Copy code
<Html>
<Head>
<Title> CSS instance 4 of Webpage Tutorial network </title>
</Head>
<Body>
<P> default browser text </p>
</Body>
</Html>

Through the above four examples, you can understand the definition of CSS and where it works.

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.