CSS背景透明但文字不透明(支援全部瀏覽器)

來源:互聯網
上載者:User

解決方案:

 

①兩個疊在一起的層

 

②用半透明的png(推薦)

  

背景透明但文字不透明

 

 

 

 

 

 

 

 

支援IE、Firefox、Chrome、Opera

支援所有瀏覽器

<html> 
<title>透明</title>
<head>
<style>
#container {
    color: #154BA0;
    background: #ff0000;
    filter: Alpha(Opacity=10, Style=0);
    opacity: 0.10;
    position: absolute;
    height: 200px;
    width:500px;
    z-index:20;
}

#text {
    position: absolute;
    height: 200px;
    width:500px;
    text-align:center;
    z-index:30;
}
</style>
</head>
<body >
<div id="container"></div>
<div id="text">背景半透明但文字不透明</div>
</body>
</html> 

相關文章

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.