This paper introduces two special effects codes that use CSS to achieve transparent background images and opaque text.

Source: Internet
Author: User
This article mainly introduces the CSS to achieve transparent background image and text opacity effect of two methods, the need for friends can refer to the next

Summary:

Method One (frosted glass effect): Background image + Pseudo class + Flite:blur (3px)

Method Two (translucent effect): Background map + positioning + Background:rgba (255,255,255,0.3)

CSS to achieve a transparent background picture, text opacity effect of two ways

Projects are often used to put some text on the background map, the introduction of two techniques to achieve a transparent background image, text opaque effect, record, easy to learn later.

1. Frosted Glass Effect:

Background map + pseudo class + Flite:blur (3px)

. demo1{    width:500px;    height:300px;    line-height:50px;    Text-align:center;}. demo1:before{    Background:url (http://csssecrets.io/images/tiger.jpg) no-repeat;    Background-size:cover;    width:500px;    height:300px;    Content: "";    Position:absolute;    top:0;    left:0;    Z-index: -1;/*-1 can be background *    /-webkit-filter:blur (3px);    Filter:blur (3px);}
<p class= "Demo1" > Background map Translucent, text opaque <br/> Method: Background map + filter:blur</p>

2. Translucent Effect:

Background map + positioning + Background:rgba (255,255,255,0.3)

. demo2-bg{    Background:url (http://csssecrets.io/images/tiger.jpg) no-repeat;    Background-size:cover;    width:500px;    height:300px;    Position:relative;}. demo2{    Position:absolute;    left:0;    right:0;    top:0;    bottom:0;    width:500px;    height:300px;    line-height:50px;    Text-align:center;    Background:rgba (255,255,255,0.3);} <p class= "DEMO2-BG" >    <p class= "Demo2" > Background translucent, text opaque <br/> Method: Positioning + Background:rgba ( 255,255,255,0.3) </p></p>

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.