Current location - Quotes Website - Signature design - Unable to reference css style.
Unable to reference css style.
CSS style reference method

CSS is a markup language, which can be directly executed by the browser without compilation (it belongs to the browser interpretation language), and it is the abbreviation of cascading style sheets. In the standard web design, CSS is responsible for the presentation of web content (XHTML), and together with the page structure organized by Div (or table), it realizes a complete web layout. By studying CSS markup language, you can easily realize the rich expression of the page. The application of CSS is actually the process of embellishing sketches into oil paintings.

In the process of style calling, the style definition closest to the target has higher priority. The high-priority style inherits the non-overlapping definition of the low-priority style, but overwrites the overlapping definition.

These four solutions are:

1, embedded style;

2. Define the embedded style block;

3. Link to the style sheet.

4. Joint use of style sheets (@import import function).

1, embedded style.

Inline definition, that is, directly using the style attribute to define the style in the label of an object, is the simplest style calling method, which can skillfully apply the style to each label object, and is simple to use and intuitive to display. However, it can't give full play to the advantages of "presentation and content separation" of style sheets, so it is not commonly used in the design process.

Take a simple example: apply different styles to the same P-tag attribute.

The font is displayed in red with 12 pixels.

The font is displayed as blue 12 pixels.

If you want to change colors, you have to change them separately. Maybe you will say that there are only two, and it won't take too long to modify them separately. So for large websites, can countless P tags be manually modified one by one?

Conclusion: This method is suitable for attributive of sentences.

2. Define embedding a style block.

That is, in HTML documents.

Inserts a block object between the and tags.

head & gt

style type="text/css " >

! –specific content of style sheet–>

/style & gt;

/head & gt;

The type attribute of style is set to "text/css", which allows browsers that do not support this type to ignore style forms, helping such browsers to filter out css codes and avoid displaying this style sheet directly as source code in browsers.

Abstract: This method is suitable for modifying the properties of a page.

3. Link to the style sheet.

First, a separate external style sheet file (suffix. Css) should be established, and then it is also in the HTML document.

Insert a link object between the and tags in the following format:

head & gt

link rel="stylesheet" href="*。 css" type="text/css " >

/head & gt;

Summary: This method applies to the whole attribute, so I use this method. Hey hey.

4. Joint use of style sheets (@import import function)

The method of using @import to combine style sheets is the same as that of linking external style sheets, and it is also in an HTML document.

And is inserted between the mark and the sign; However, this method can link external style sheets and make style rules that other pages don't need according to the specific situation of this page, which is more advantageous. The format is as follows:

head & gt

style type="text/css " >

& lt! –

@import "*。 css "

Declarations of other style sheets

–& gt;

/style & gt;

/head & gt;

It should be pointed out that:

The syndication input style sheet must start with @import and start with ";" The end is over;

If there are conflicts between multiple style sheets entered at the same time, the style sheet entered first will be handled effectively;

If the input style sheet conflicts with the style (embedded definition) rules in the web page, the external style sheet is used.