0322CSS style sheet, selector

Source: Internet
Author: User
Tags tag name

CSS style Sheets

Inline style sheet: <p style= "FONT-SIZE:14PX;" > Inline style Sheets </p>

Inline style sheet: must be written in the head tag.

<style type= "Text/css" >

P//format works on P tags

{

Style

}

</style>

External style sheet: Create a new CSS file to place the style sheet. If you want to call a style sheet in an HTML file, you need to right-click in the HTML file to →css the style sheet → attach the style sheet. The link connection method is generally used.

Example: Source code

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>

<title> Untitled Document </title>

<link href= "Untitled-css.css" rel= "stylesheet" type= "Text/css"/>

<body>

<p> Chad Most handsome, everyone loves </p>

</body>

CSS file:

@charset "Utf-8";

/* CSS Document */

<style>

*

{

margin:0px;

padding:0px;

}

P

{

Background-color: #F00;

Color: #0F0;

font-size:90px;

}

</style>

Selector Selector

1. Tag Selector. Use the tag name to make the selector.

2.class The selector. It's all about "." start.

3.ID The selector. Start with "#" .

<div id= "style name" >

4. Composite Selector

(1) separated by "," to indicate juxtaposition.

(2) separated by a space, indicating descendants.

(3) filter ".".

style attributes;

(i) Background and prospects

1. Background:

2. foreground font:

(ii) Borders and borders

Border (table borders, styles, etc.), margin (off-table spacing). padding(content and cell spacing).

(c) List and block

width , Height , ( Top , Bottom , Left , Right ) is useful only in the case of absolute coordinates.

linked to style :

A:link The hyperlink is pre-state.

a:visited Post-click status of Hyperlinks

a:hover when hovering over a hyperlink

a:active When you click the hyperlink

When defining these states, there is a sequence l v H a

0322CSS style sheet, selector

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.