Internet Explorer and mainstream browser for CSS style background transparent, font opaque processing method

Source: Internet
Author: User

Just learned the CSS compatibility problem, the compatibility issue is our front-end developers have to cross the gap, for different browsers, we have to consider its compatibility, code operability, because the same piece of code may be in the Google and Firefox and other mainstream browser display is normal, but in Internet Explorer is displayed very strange , especially with IE6 as the main object of care.

Other not to say, here as the title is written, I mainly solve the CSS to achieve transparent background and text opaque method, tested, their own code in IE and non-IE browser can display normal, there is code deficiencies, let everyone correct, everyone's efforts to create our web front-end tomorrow.

In the non-IE browser to achieve the background and font with the transparent method is: opacity:0.1 (where the value of 0-1 , the greater the value, the more opaque)

For non- IE Browser to achieve transparent background, font opacity method:

(where the value is between 0-1 , the greater the value, the more opaque)

Implement background and font transparency under IE browsing to invoke the IE filter command:

(color pickup,\9 representative can only IE6,7,8 recognition)
Filter:alpha (OPACITY=20);

(where the value is between 0-100 , the greater the value, the more opaque)

To make the background transparent font opaque under IE, you need to add relative positioning under the current sub-element:

position:relative;

Here's an example:

CSS code:<style>
*{padding:0; margin:0;}
body{padding:50px; }
#d1 {margin:0 auto; width:300px; height:300px;

/* Background transparent, font opaque */
Background-color: #ffffff; /* Implement background and child element fonts are transparent */
opacity:0.1;
/* Support IE6, 7, 8*/
Background-color: #ffffff \9;
Filter:alpha (OPACITY=20); }

p{color:red; font-size:50px text-align:center;
position:relative; /*//sets the child element as relative positioning, allowing the child element to not inherit the alpha value </style>} */

HTML code:<div id= "D1" >
<p> background Transparency <br> text opacity </p>
</div>

As above is all the code, I think as long as the intentions, I believe that we can read it ' (*∩_∩*)

Internet Explorer and mainstream browser for CSS style background transparent, font opaque processing method

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.