PHP Full Stack Development (eight): Cssⅰ selector

Source: Internet
Author: User

Up until now, we have passed the entire process of PHP to HTML through PHP to the server and then through PHP to the database, then from the database, through a single case.

It can be said that these have only just begun. Let's start the second phase of this whole process and begin designing a sign-in page.

We need to use a lot of knowledge of the layout of CSS.

First, CSS refers to cascading style sheets, which are cascading style Sheets

Style, also known as style, is the most central part of CSS.

Style, style defines how HTML elements are displayed.

So let's look at what CSS statements are:

Selector {property: Value; property: Value;}

Above this is a CSS statement.

Selector We will encounter a lot in the future, like class selector, tag selector and so on.

CSS statements are always terminated with a semicolon and enclosed in curly braces.

For example

P {color:red; text-align:center;}

This is a set of CSS statements.

Comment, the CSS annotation method uses the/* Comment content * * In such a way to annotate.

Well, with all that said, we can begin to introduce the most important selectors in the CSS statement.

Without selectors, there is no CSS

Selectors are used to select things in an HTML page, and then we'll specify the colors and styles after selecting them.

The first thing we want to introduce is

ID Selector

As we all know, the HTML tag has an id attribute, the id attribute is unique, then we can select a specific tag by the CSS ID selector, and then specify the style of the tag.

So how does our ID selector be declared in CSS?

Use the # number.

That's it, #号, remember.

For example, if the ID of a tag is name, then we can select it with the following code and specify its style

#name {text-align:Center; color:red;}

OK, we're done with the ID selector, and then we'll start the next selector, which is the class selector.

Class Selector

Class selector and ID selector are different, class represents a class, you can have several tags belong to one class

We can set the style of several tags for this class at the same time

The class selector starts with the dot.

This is a good memory, our class in C + + its properties are used to express.

So the point at the beginning is the class selector, if we have a class called center, then we can set the following

. Center {text-align:center;}

Tag Selector

The tag selector starts with a label. For example, start with a P tag

P {text-align:center;}

Of course we can mix it up with

For example

P.center {text-align:center;}

This is the class in which all P tags are centered.

Instead of all p labels are centered

It seems to be very convenient.

PHP Full Stack Development (eight): Cssⅰ selector

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.