After XHTMLWebsite productionBasic knowledge, the next step will be CSS.When CSS is applied to XHTML, the first thing to do is to select an appropriate selector, which is a way for CSS to control objects in XHTML documents.In short, it is used to tell the browser which object the style will be applied to.
CSS properties and selectors
The syntax structure of CSS consists of only three parts: Selector, Property and Value.
usage method:
Selector {Property:Value;}
Selectors, also known as selectors, refer to the objects to be targeted by this group of style codes. They can be an XHTML tag (such as body, h1), or a tag that defines a specific ID or class of T (such as # main, where selectors indicate the selection of<div id="main">, that is, an object with an ID named main).The browser will strictly parse CSS selectors, and each set of styles will be applied to the corresponding objects by the browser.
Property is the core of CSS style control. For all the XHTML tags, CSS provides rich style properties, such as color, size, positioning, floating mode, etc.
Value refers to the value of an attribute. There are two forms. One is the value of a specified range (for example, the float attribute can only be used with three values: left, right, and none), and the other is a value (for example, width can be specified with 0-9999px or other mathematical units).
In practical applications, we often use the following types of applications:
body {background-color:blue;}
It indicates that the selector is body, that is, the<body>tag in the page is selected, and the attribute is background color. This attribute is used to control the background color of the object, and its bit is blue.It can be seen that the background color of the body object in the page is defined as blue by using this group of Css codes.
In addition to the definition of a single attribute, you can also define one or more attributes for a single label. Each attribute is separated by a semicolon.
Type Selector
The body {} above is a type selector.The so-called type selector refers to the selector of the name based on the existing tag name in the web page. Body is a tag name in the web page, so is div, and span is no exception.Therefore, the following selectors are type selectors, which will control all body (there is only one body naturally). div or span in the page