iT邦幫忙

第 11 屆 iThome 鐵人賽

DAY 2
0
Modern Web

從Stack Overflow學前端系列 第 2

從StackOverflow上學CODING(2)如何給字或背景一個透明背景

How do I give text or an image a transparent background using CSS?
https://stackoverflow.com/questions/806000/how-do-i-give-text-or-an-image-a-transparent-background-using-css

p {
  position: absolute;
  background-color: green;
  filter: alpha(opacity=60);
  opacity: 0.6;
}



span {
  color: white;
  filter: alpha(opacity=100);
  opacity: 1;
}

作者使用了opacity屬性,但這個屬性會造成整個tag透明
如果只是要讓背景透明:直接使用rbg第四個數字更好:

background-color:rgba(255,0,0,0.5);


上一篇
從StackOverflow上學CODING(1)
下一篇
從StackOverflow上學CODING(3)如何置中一個div
系列文
從Stack Overflow學前端30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言