Understanding CSS Definition

Source: Internet
Author: User
I. Definition of CSS
There are many methods to define CSS-like expressions.
Method 1, in

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--> <Head runat = "server">
<Style type = "text/CSS">
Body
{
Font-family : Verdana, sans-serif ;
Font-size : Small ;
}
<Title> untitled faces </title>
</Head>

Method 2: Use style in <body>... </body> to define the CSS <TD style = "position: absolute" width = "100%">

Method 3: Save the edited CSS document as a ". CSS" file and define it in

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><LINK rel = stylesheet href = "CSS file">

Description:
"Rel = stylesheet" indicates that the connected element is a style sheet document. No need to change here.
Href='style.css 'specifies the CSS file.
The following is the primary generation: <Head runat = "server">
<LINK rel = "stylesheet" href = "style.css"/>
</Head>

Ii. Usage of class and ID
In CSS, define ID to start with "#"; define class to start.
The definition format is divided: Label. Class Name { Attribute : Attribute Value }
. Class Name { Attribute : Attribute Value }
The. Class Name specifies the label { Attribute : Attribute Value }

Specify tag # Class Name{Attribute:Attribute Value}
# Class Name{Attribute:Attribute Value}
# Specify a tag by Class Name{Attribute:Attribute Value}

The following is the primary generation: <Style type = "text/CSS">

# Navigation Li
{
Margin-left : 1px ;
Width : 120px ;
}

. My_sytle
{
Width : 120px ;
}
</Style>

Differences between class and ID:
The difference between class and ID is just ". "and" # ", their biggest difference is: the ID selector can only be used once on each page, it is unique, and the class can be used infinitely.

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.