Home > 类库下载 > java类库 > body text

css usage

高洛峰
Release: 2016-10-08 15:36:18
Original
1769 people have browsed it

<br/>
Copy after login
Copy after login

Css (Cascading Style Sheets, cascading style sheets) is a page beautification method that achieves the effect of beautifying the page by editing the object properties of Css. The basic unit of operation of CSS is an object. Using CSS feels like using a function in C++/C. CSS objects are like functions, which are used through definition, declaration, and call.

CSS has three selectors (object definition and usage methods): tag selector, category selector, ID selector

CSS has four inclusion methods: inline, embedded, link, and imported

Tag selector:

Definition: referenced style object name {tag attribute: attribute value; tag attribute: attribute value;…….}

eg: h1,h2{text-align: center; color: red } Tag attribute: attribute value; Tag attribute: attribute value;…….} or

      . Class name {Tag attribute: attribute value; Tag attribute: attribute value; …….}

                                                                                                                          Label attribute: attribute value; : center; }

               .right{ text-align: right;                                                                                                                                                           ;……..

(*Difference: The latter format means that all tags whose class attribute value is the class name comply with the style defined by the class)

  (eg: .right{ is defined text-align: right;}, when called, as long as the label with the right attribute is called through class, the right attribute can be displayed.

…..

;

…  

;; and other tags all show the right-aligned attribute)

. ID selector:

Definition: #id name {tag attribute: attribute value; tag attribute: attribute value;…….}

eg: #sample{font-family:宋体; don't-size:60pt;}

Use:

……

Inline:

No need to define a selector, use the style attribute to directly style the element

eg:

...

Embedded:

First define the selector and define the style sheet between . R EG: re

<html>
        <head>
           <title>xxxxxx</title>
            <style type=”text/css”>
                p{color: #000FF;}
                .info{font-size: 12px;}
             </syle>
        </head>
 </html>
Copy after login
E

Links:

The object defined is placed in a file with a .css as an extension. , between .

eg:

Import:

is similar to the link method, except that it is imported through the import method.

eg:

Priority of CSS style sheet:

Embedded style sheet> Linked style> External link style> Browser default

<br/>
Copy after login
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!