Css stylesheets basic concepts of CSS style

The basic concept of CSS style sheets

A style sheet classification

1, the inline style sheet

<P style = "fint-size: 24px;"> be styled directly </ style> tags inside

2, embedded style sheet

<head>

<style type="text/css">

p / p * to the label name, what would you do this all the p tag style * /

{

     style}

</style>

</head>

3, an external style sheet (the most common)

Create a new css file, you need to call in html css style sheet file, you need to click on the right -css style in html file - Attach Style Sheet. With a link link

* / * Remove all labels spacing, margins *,

{

     margin:0px;

     padding:0px;

}


Second, the selector

1, class selector may use a plurality of

<style>

.main

{

     height:100px;

     width:100%;

     text-align:center;

}

</style>

<body>

<Div class = "main"> <div> call class Style Sheets

</body>

</body>

2, ID may be used only once selector

<style>

#a

{

width:100%;

height:100px;

backgroun-color:red solid 2px;}

</style>

<body>

<div id="a"><div>

</body>

3, the composite selector

1) p, span two kinds of tags using both styles look

{

style}

2) p .main be used when referring to .main .main styles included in the style tag label p

<Div class = "main"> <p> </ p> </ div> p div tag tag attributes

3) p.sp (SELECT) to perform "class =" sp "this style tags within all p

<P class = "sp"> <p> This use of the label

<P> </ p> is not used on the label

Guess you like

Origin www.cnblogs.com/look-up-at-the-starlit-sky/p/11184079.html