CSS Language Notes<1>_html/css_WEB-ITnose

WBOY
Release: 2016-06-24 11:46:53
Original
1068 people have browsed it

CSS (Cascading Style Sheets) Chinese: Cascading Style Sheets

Defined syntax:

Example:

<style type="text/css">a{  color:red;  text-align:center;  font-size:24px; }</style>
Copy after login

Selector

id selector

HTML tag attributes use id to set the selector, and use "#" to select in CSS.

For example: A piece of text

The following is the method of selecting the representation.
Example:

<style type="text/css">#a{  color:red;  text-align:center;  font-size:24px;    }</style>
Copy after login

class selector

If it is a class selector, it is written with a "." symbol, and the id selector The difference is that the class selector can be used in multiple HTML tags.

For example:a paragraph of text

a paragraph of text

Example:

<style type="text/css">.qqq{    color:red;    text-align:center;    font-size:24px;        }</style>
Copy after login

The second way of writing represents the qqq element under the a tag

<style type="text/css">a.qqq{   color:red;   text-align:center;   font-size:24px;       }</style>
Copy after login

multiple elements Selector

Example:

<style type="text/css">a,b,c,d{        color:#FFFFFF;        text-align:center;        font-size:24px;        }</style>
Copy after login

Descendant element selector

selects the li element under a in the instance. Descendant elements are selected with spaces. .

Example:

<style type="text/css">.a li{       color:red;      }</style>
Copy after login

Child element selector

Child element is the same element under class, parent-child relationship. Use the greater than sign to represent

Example:

<style type="text/css">.a > .title{                color:#FF6300               }</style>
Copy after login

Summary

ID is unique and class is versatile.

To be continued.............

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!