Home  >  Article  >  Web Front-end  >  What is a CSS style sheet? Detailed explanation of examples of CSS style sheets

What is a CSS style sheet? Detailed explanation of examples of CSS style sheets

零下一度
零下一度Original
2017-06-16 14:52:322992browse

What is a style sheet

CSS is the abbreviation of Cascading Style Sheet. Translated as "Cascading Style Sheets". Is a markup language used for (enhanced) control over web page styling and allowing the separation of style information from web content.

How to add a style sheet to your web page

You can add a style sheet to your web page in the following three ways. The style definition closest to the target has higher priority. A high-priority style will inherit the non-overlapping definitions of the low-priority style but override the overlapping definitions. See important declaration for exceptions.

Linking to a Style Sheet

You can create an external style sheet file (.css) first, and then use the HTML link object. An example is as follows:

<head>
<title>title of article</title>
<link rel=stylesheet href="www.dhtmlet.com/rainer.css" type="text/css">
</head>

In XML, you should add it in the declaration area as shown in the following example:

<? xml-stylesheet type="text/css" href="www.dhtmlet.com/rainer.css" ?>>

Define an internal style block object (Embedding a Style Block)

You can insert a 812f7be0e9ba70c6f2a66273c3c04692...a2d87b9af1e305217ec9648d1e8a0a47 block object between the 6a74014ee44f5deb5894267f99b68016 and a64997a0904a094b4570728d7f327acd tags in your HTML document. For definition methods, please refer to style sheet syntax. An example is as follows:

<html>
<style type="text/css">
<!--
body {font: 10pt "Arial"}
h1 {font: 15pt/17pt "Arial"; font-weight: bold; color: maroon}
h2 {font: 13pt/15pt "Arial"; font-weight: bold; color: blue}
p {font: 10pt/12pt "Arial"; color: black}
-->
</style>
<body>

Please note that setting the type attribute of the style object to "text/css" here allows browsers that do not support this type to ignore the style sheet.

Inline Definition (Inline Styles)

Inline definition is to use the object's style attribute within the object's tag to define the style sheet attributes that apply to it. An example is as follows:

<p style="margin-left: 0.5in; margin-right:0.5in">这一行被增加了左右的外补丁<p>

Style sheet syntax (CSS Syntax)

Selector { property: value }
Parameter description:
Selector -- Selector
property : value -- style sheet definition. Properties and property values ​​are separated by a colon (:). Separate definitions with semicolons (;)

The ' Inherit ' Value

Each property has a specified value: Inherit. It means: equate the value of the parent object to the computer value. This value is usually only available as a backup. Explicitly declaring it can be used for emphasis.

CSS is the abbreviation of Cascading Style Sheet. Translate cascading style sheets, combined style sheets, etc.
for example. For example, tables or divs are the building blocks of a house, and they are used to set up the framework of the entire website. And css is the decoration of the house. A website without polish is ugly.
We usually use CSS to modify the color, text, etc. of the website.
If you want to know more about CSS, you can search online. There are many online. I'm just telling you from my practice. Finally, I just want to say that style and framework are inseparable.

The above is the detailed content of What is a CSS style sheet? Detailed explanation of examples of CSS style sheets. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn