Chapter 2 Transparent Border of Background & amp; Borders, Chapter 2 background

Source: Internet
Author: User

Chapter 2 Transparent Border of Background & Borders; chapter 2 background
1. Translucent (Translucent) border

The first example in Chapter 2 is to implement a translucent border. The effect is as follows:

At first glance, it's very easy. The boder is just done. The Code is as follows:

Border: 10px solid hsla (0, 100%,. 5 );

Background: white;

However, this does not work at all. The effect is that border is missing ....

 

Sorry... what's going on? Originally, border did not disappear. Our background: white covered the border-_-, so we only need to change the width of the background to the padding of the box.

 

After the background: white is removed, the border of the box is clearly displayed.

 

The background attribute is overwritten by default by border-box. to modify it, you can use the background-clip attribute (IE9 + ):

Background-clip: content-box | padding-box | content-box

After adding background-clip: padding-box to the box, we can achieve the desired effect.

 

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.