Getting started with CSS

xiaoxiao2021-03-06  113

Day 7: Author: Acha 2004-6-25 1:05:46

After understanding the XHTML code specification, we have to make a CSS layout. First introduce some Getting-start knowledge of CSS. If you are already familiar, you can skip this section and go directly into the next section.

CSS is an abbreviation for Cascading Style Sheets. It is a simple mechanism for adding styles to web documents, which belongs to the layout language of the performance layer.

1. Basic syntax specification

Analyze a typical CSS statement:

P {color: # ff0000; Background: #ffffff}

"P" we call "Selectors" indicating that we have to define the style to "P"; style declaration is written in a pair of braces "{}"; color and background are called "property" Different attributes are divided by semicolon ";" separated; "# ff0000" and "#ffffff" are values ​​for attributes (Value).

2. Color value

The color value can be written with RGB value, for example: Color: RGB (255, 0, 0), can also be written with hexadecimal, just like the above example color: # ff0000. If the hexadecimal value is a repetitive, the effect is the same. For example: #f0000 can write to # f00. But if you don't repeat, you should not be short-written, for example # fc1a1b must write over six.

3. Define the font

The Web Standard recommends the following font definition method:

Body {Font-Family: "Lucida Grande", Verdana, Lucida, Arial, Helvetica, Song, SANS-Serif;

The font is selected in the order listed. If the user's computer contains the Lucida Grande font, the document will be specified as Lucida Grande. No, it is specified as a Verdana font. If there is no Verdana, it is specified as a Lucida font, and the Lucida Grande font is suitable for Mac OS X; Verdana font is suitable for all Windows systems; Lucida is suitable for UNIX users "Song" suitable Chinese Simplified users; if the fonts listed cannot be used, the default SANS-Serif font ensures call;

4. Group selector

When several element style properties, a statement can be called, and the elements are separated by commas,: p, td, li {font-size: 12px;}

5. Delivery selector

You can define a style using a derived selector to define a pattern in an element, for example:

Li Strong {font-style: italic; font-weight: Normal;

It is the subsidence of the subsidence from the child. Strong is defined for the subsidence of the LI.

6.id selector

The CSS layout mainly uses the layer "div" to achieve, and the pattern of DIV is defined by the "ID selector". For example, we first define a layer.

转载请注明原文地址:https://www.9cbs.com/read-100462.html

New Post(0)