I am looking to make a div tags background invisible. I don't want the text to be invisible. If I use css opacity to get it done then the whole div tag disappears. I only want the background to go.

I searched the net but there aren't any easy to find examples.

Hope someone can help me out here.


Recommended Answers

All 3 Replies

<script type="text/javascript">
var bg
function ShowBackground(id){
if (document.getElementById(id).style.background==""){
function HideBackground(id){
if (document.getElementById(id).style.background!=""){
document.getElementById("idElement").setAttribute("title", bg);

I didn't try it yet

will give it try in 2011 and will let you know.

Happy New Year !!

If you only want the opacity to affect the background, place the text in a separate element and position it over the background. Absolute positioning, floats, z-index, etc.

Regards, Arkinder

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.