Using CSS3 linear-gradient to implement the shopping cart address selection envelope Effect instance

Source: Internet
Author: User
For the CSS3 of the gradient front of the children's shoes must not be unfamiliar, in some e-commerce website will be to beautify the address choice to make an envelope style (personal feeling very porridge ~), looked at its implementation, most of it is in the form of pictures, holding an optimized mentality to try to use CSS3 Linear-gradient implementing the Envelope effect is

Here we go

The HTML structure is as follows:

<p class= "Letter-box" >
<p class= "Letter-border" >

</p>
</p>

CSS styles are as follows:

. letter-box{
width:278px;
height:176px;
padding:5px;
Box-sizing:border-box;
}
. letter-border{
width:100%;
height:100%;
Background: #fbfaf5;
}

The gradient is written on the Letter-box, and then the Letter-border is obscured by the color of the middle part.

Next we write the gradient to the Letter-box, first of all, we first analyze the top of the gradient actually a total of three colors white, red and blue. We all know that when using linear-gradient, in addition to the beginning of the definition of the angle of the gradient we also define the color and color of the proportion of the color we now know, then we now say how to determine the ratio.

Observation we can find the rule a red, a white, a blue, a white for a cycle, then our law number is 4, our proportion with 100%/(our law number *) =12.5% is our proportion. Explain why we have to use our regular number, should not be the rule number is a combination? No! put the color of a combination number in a cube inside, in order to facilitate everyone to understand P has a

This is supposed to be intuitive. We think of the big box as repeat in small cubes.

. letter-box{
width:278px;
height:176px;
padding:5px;
Box-sizing:border-box;
Background:linear-gradient (45deg, #f25953 12.5%, #fbfaf5 12.5%, #fbfaf5 25%, #5590d6 25%, #5590d6 37.5%, #fbfaf5 37.5%,# Fbfaf5 50%, #f25953 50%, #f25953 62.5%, #fbfaf5 62.5%, #fbfaf5 75%, #5590d6 75%, #5590d6 87.5%, #fbfaf5 87.5%, #fbfaf5 100%);
background-size:70px 70px;
}

Related Article

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.