CSS3 Example Tutorial: Using border

Source: Internet
Author: User
Tags add define curl implement
Article Introduction: proficiency in the use of Border-radius.

The purpose of this example: proficiency in the use of Border-radius

Related properties: Border-radius, linear-gradient, Box-shadow hint: ": Before" ": after", ie on after, before is not supported, please in Firefox, Opera, Chrome, try the tune! Requirements Browser: Firefox, opera, Chrome effect chart:

First look at the general steps: 1. Define class, draw a rectangle; 2. Use the Border-radius property to handle its fillet; 3. Create Curl angle using pseudo element; 4. Create the effect of a section gradient. Detailed steps First step: Define class, draw a rectangle:

<a class= "Docicon" href= "#" >document icon</a>

Note here: "Display" The default property value is "inline", so we want to use "block" property value to ensure that it is displayed correctly:

 
  
  

The linear-gradient here is the gradient effect setting. Add the shadow effect below and use the "Box-shadow" property to implement:

 
  
  

The Box-shadow here is the shadow effect setting. So far, we have completed the following effect, as shown in figure:



Part II: Using the Border-radius property to handle its fillet:Please click here to find out the definition and usage of Border-radius. Code:
 
  
  

As shown in figure:

Ps: Here to focus on the hint: Before is a pseudo class selector, only support Firefox, opera, Chrome. You may not understand the following two steps, this does not matter, I will write a detailed article for them. In this example, we just know that we have used ": Before" ": after" the two pseudo-class selector can be. Part III: Curl up the corner

First, add ": Before", we need to create a 15px rectangle and apply a background gradient:
 
 
  1. . docicon:before {
  2. Content: "";
  3. Display:block;
  4. Position:absolute;
  5. top:0;
  6. right:0;
  7. width:15px;
  8. height:15px;
  9. Background: #ccc;
  10. Background:-webkit-linear-gradient (45deg, #fff 0, #eee 50%, #ccc 100%);
  11. Background:-moz-linear-gradient (45deg, #fff 0, #eee 50%, #ccc 100%);
  12. Background:-o-linear-gradient (45deg, #fff 0, #eee 50%, #ccc 100%);
  13. Background:-ms-linear-gradient (45deg, #fff 0, #eee 50%, #ccc 100%);
  14. Background:linear-gradient (45deg, #fff 0, #eee 50%, #ccc 100%);
  15. -webkit-box-shadow:rgba (0,0,0,0.05) -1px 1px 1px, inset white 0 0 1px;
  16. -moz-box-shadow:rgba (0,0,0,0.05) -1px 1px 1px, inset white 0 0 1px;
  17. Box-shadow:rgba (0,0,0,0.05) -1px 1px 1px, inset white 0 0 1px;
  18. border-bottom:1px solid #ccc;
  19. border-left:1px solid #ccc;
  20. }

Next we want to achieve the effect of rounded corners in the upper right corner, we use the same method to align:

...

-webkit-border-radius:3px 15px 3px 3px;

-moz-border-radius:3px 15px 3px 3px;

border-radius:3px 15px 3px 3px;

Here's what we've achieved today:

Fourth Step: Add the article Gradient effect:

Below we use ": after" to achieve the effect, we show a high positioning 0,0. We apply the overall width of 60%, plus

Margin-left and margin-right 20% (i.e. 100%):

 
  
  


To implement multiple line gradients with CSS3:

 
  
  



Final results:



Large-Scale Price Reduction
  • 59% Max. and 23% Avg.
  • Price Reduction for Core Products
  • Price Reduction in Multiple Regions
undefined. /
Connect with us on Discord
  • Secure, anonymous group chat without disturbance
  • Stay updated on campaigns, new products, and more
  • Support for all your questions
undefined. /
Free Tier
  • Start free from ECS to Big Data
  • Get Started in 3 Simple Steps
  • Try ECS t5 1C1G
undefined. /

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.