CSS Basic Properties

Source: Internet
Author: User

Selector:
Ul>li:nth-child (2n) {color:black;}

2n refers to even-numbered, with even consent.

2n+1 refers to the singular and agrees with odd.

<div class= "text" ><p>p label </p><a href= "" > Test </a><a href= "" > Test </a></div >

A:first-child is the first structure tag under the. Text, and it's a tag, not the effect.

A:first-of-type does not need to be the first child element, only the first of the A tags under the. Text can be
The former does not have a restricted scope is a tag, the latter is limited to a tag.

Div[class]{color:black;}

These are the DIV elements that have the class attribute selected.

div[class= "Div1"]{color:red;}

  

div[^class= "Div1"]{background: #000;}

The above is the DIV element that selects the class attribute to start with Div1, and ^ and $ represent the beginning and the end respectively, which are the same as regular expressions. You can find the rules.

div[~class= "Div1"]{background: #000;}

These are the DIV elements that select the class attribute that contains DIV1.

P:first-letter{font-weight:bold;}

The above is the first character of the select P element.

The same first-line, the selector is to select the first line, as long as the literal understanding of the meaning of these selectors, the use of it is not a problem, the premise is English must pass, these common English to accumulate slowly.

E:placeholder: Sets the style of the placeholder.

Basic Properties:
P {font-family: ' Arial ', ' Black body ', ' Soong '}

Set the name of the text, you can use multiple names, or separate them with commas, and the browser uses the available fonts in order of precedence.

P{font-size:1.6em;}

This style sets the font size, and it is recommended to use relative units, which is more beneficial for browser compatibility.

P{[font-weight:bold;}

This style sets the font weight.

P{font-style:italic;}

This style sets the font style, which is typically used for this italic property.

The above properties can be abbreviated with the Font property.

The Color property sets the font colors to be distinguished from the Background-color property, which is to set the background color.

P{text-decoration:underline;}

The above is the setting of text decoration, the most commonly used is the underscore value, there are underline, Line-through.

p{text-shadow:10px 10px 5px Red;}

The style sets the text shadow.

About the box model this piece of content is too much to talk about, not few words can speak clearly. In short, an element is surrounded by border, inside there is padding and content, border outside is the margin attribute, skillfully use these properties can achieve unexpected effect.

  

CSS Basic Properties

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.