Some tips for CSS3 examples

Source: Internet
Author: User
Tags define definition border color end visibility

CSS3 examples you should know a few CSS3 tips, if you don't know what a browser's specific statement is, you just have to remember that they are specific prefixes that are related to the kernel vendor before CSS style properties. Since CSS3 has not yet received one-sided support, we need to make use of these specific statements. The specific situation is as follows:

Prefix of the Mozilla/firefox/gecko browser:-moz-

Webkit (sari/chrome) Browser prefix:-webkit-(Note: Some wbkit prefixes can only be used in Sari, Chrome does not support.) )

As you may have seen, there is a false truth in using these statements that if we want to get the results of CSS3 in Firefox,sari and chrome, we need to use all these prefixes. Not surprisingly, ie browsers do not support CSS3, so it is not like other secondary browsers have a specific prefix declaration.

Well, we've talked enough, let's take a quiz. Note: The style declaration removing these prefixes is the W3 standard of implicit truth.

Demo on this page (true example) statement

All of these examples are on the page, and if you can't Budie the results of the real example (or just look at the department), then stating that the browser you're using doesn't support these CSS3 results.

Shadow results

Shadow results take over multiple parameter values. The first is the color of the shadow, which also takes over the other four young (lenght) values, the first two of which are the X (degree) offset and y (vertical) offset. The next parameter is the value of the reaction trance degree. The third is the value of the moon is used to define the level of trance.

Box-shadow: #3333px3px4px;

-moz-box-shadow: #3333px3px4px;

-webkit-box-shadow: #3333px3px4px;

Shadow Results Demo

Gradient Results

CSS3 's gradient style just begins to blend easily, and there is a divergence between the special-moz and-webkit gradients. In-moz, you first need to define the target of the gradient, and then define the color of the beginning and end of the war. And the-webkit gradient is slightly larger, first you need to define the type of gradient, then the next two values define the target, the initial two values define the beginning color of the gradient and end color.

-moz-linear-gradient ( -90deg, #1aa6de, #022147);

-webkit-gradient (Linear,lefttop,leftbottom,from (#1aa6de), to (#022147));

Gradient Results Demo

RGBA Color Mode

RGBA's Yan * * said Cain really used up not to feel so large, it takes over four parameter values, this is: Red value, green value, blue value, as well as the degree of visibility. We do not eliminate the hex (#) 16 in the color of the value, we use RGB mode to set the color, in this, the degree of visibility can set the color of the brightly lit results. The degree of visibility and value category is between 0 to 1, 0 is completely owed Hemming, 1 is completely bright color. The following demo examples have 0.5 degrees of visibility, and the visibility of the elements is 50%,rgba no need to append any specific browser prefix declarations.

RGBA (0,54,105,.5);

HSL color mode (hue H, full degree s, brightness l)

In addition to RGBA,CSS3 also supports HSL color mode. This gives us plenty of room for the color-war-tone and the house. The h in this color mode is HSL the Hue, S represents chroma and L represents brightness. Hue is the value of the angle on the color plate, while the saturation battle brightness is the percentage of the color.

HSL (209,41.2%,20.6%);

HSL Demo Real Example

Border color

To take advantage of this CSS style, you need to leave the definition Border-top,border-right,border-bottom, war Border-left to get the following results. You notice the definition of a 8-pixel border, and then the border defines 8 different colors. This is because the color number of the border must correspond to the pixel width value of the border.

8pxsolid#000;

-moz-border-bottom-colors: #555 #666#777#888#999#aaa#bbb#ccc;

-moz-border-top-colors: #555 #666#777#888#999#aaa#bbb#ccc;

-moz-border-left-colors: #555 #666#777#888#999#aaa#bbb#ccc;

-moz-border-right-colors: #555 #666#777#888#999#aaa#bbb#ccc;

Border Color Demo

Text and shed color settings

I have to say the text and the definition of color is a very impulsive new effect. When I first saw this on the CSS technique, I was feeling it was very intimate. With:: Selection The Pseudo object (pseudo-element), you can change the color war set when the user chooses a text element. If you ask the insight, I will feel it is very beautiful. Of course:: Selection has removed the bird from the present draft of the CSS3, but we hope it will be added later.

:: Selection{background: #3C0;/sari/#90C;}::-moz-selection{background: #3C0;/firefox/#90C;}

Text and shed color demo

Deformation

With the deformation style, you can make the outside of the element is hovering over the mouse hover large. Set a value greater than 1 for scale (proportional) values, and the elements will be hit. Conversely or, if the value is less than 1, the size of the element will swell small. In addition to the scale ratio, it has many other differences in the deformation style available. You can look at the Firefox page and see what they can really hide.

-moz-transform:scale (1.15);-webkit-transform:scale (1.15);

Deformation results Demo

Multi-column structure

With this new multi-column structure, you can give the text a similar "" "typography result. Compared with the true implicit way in the CSS2, CSS3, we really hide such a result to be much more brief. Below, I specify the number of columns necessary for the bird, as well as the rule type of breakup, and the amount of space between columns and columns. It's very simple to use, isn't it?

-moz-column-count:3;-moz-column-rule:solid1pxblack;-moz-column-gap:20px;

Multi-Column Structure demo

Summarize

I wish I could be as excited about CSS3 as I am. He gives the web-architects a lot more strength and makes many things easier. Cain is, we just look forward to all browsers to support it. Of course, the knowledge I demonstrate here CSS3 the tip of the iceberg of new efficacy. If you want to learn more news, technical warfare assistance, I you wait for these websites to study.



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.