How to make a transparent background without background image?

前端 未结 4 2126
再見小時候
再見小時候 2020-12-17 21:03

I would like a div to have a transparent background.
I tried to do this using background-color and opacity, but the problem is t

4条回答
  •  没有蜡笔的小新
    2020-12-17 21:50

    Yes.

    Set background-color: transparent;

    and do not use opacity, as that is what makes semi-transparent the whole div..

    updated your example at http://jsfiddle.net/eU7By/1/

    UPDATE after comments

    you can use rgba for the background-color as @DHuntrods mentions. IE needs some tweaking of'course.. http://leaverou.me/2009/02/bulletproof-cross-browser-rgba-backgrounds/

提交回复
热议问题