Background Transparency in A Table attribute?

They have: 42 posts

Joined: Dec 2002

Happy Holidays All,

Can anyone tell me if there is a way to control the transparency level of a background color within a table?

I suppose the correct term would be control the alpha state.

Any help would be great!

Thanks
Dan

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

You cannot at this point control it using standards.

You can control it in IE, perhaps, using the CSS filter options.

Otherwise you can use what is called "ghosting" which is making the image transparent in alternating pixels.

They have: 42 posts

Joined: Dec 2002

Hi Suzanne,

I found what I was looking for.

Works perfect in Explorer.
Will this work in Netscape too?

Is this css?

Dan

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

No and yes. Smiling

The style attribute is inline CSS, and that particular CSS declaration will only work in IE as it's not part of the standard, but a proprietary IE format.

Before it causes you problems, you might want to fix your code:

1. put quotation marks around all attribute values
2. remove the extra quotation mark from the height attribute value

They have: 42 posts

Joined: Dec 2002

Hello Suzanne,

Someone has told me that this will work in Netscape:

Do you know if it will?

Thanks for your help!

Dan

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I haven't looked into the moz- bits, they have actually just crossed my realm of awareness, as it were, in the last few days. If it works, great! If you have a test page, I'll test it for you on the mac, or you can check in N7 on your own machine.

Those are both proprietary styles, and not part of the standard, but if both main browsers are starting to do it, then perhaps it will be added to the standard eventually.

The only thing you'll want to be careful with is that browsers that DON'T support these styles will still be able to render the content viewable.

I personally try to stick to the standards and avoid proprietary coding, but I also believe that as long as it doesn't mess anyone else up (Netscape 4.x, for instance, won't know what that is, only N7, which is based on the Mozilla browser -- mozilla.org ), it's great to experiment.

How about making a test page and trying it yourself?

dk01's picture

He has: 516 posts

Joined: Mar 2002

Yes NS6 and 7 support -moz-opacity. You can even access it through javascript and everything. I think however that it your pages might cause lower browsers to hang up.
-dk

Busy's picture

He has: 6,151 posts

Joined: May 2001

Also the bordercolour bits is an IE thing

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

it's annoying how ie supports so many things that others don't, things that aren't standard...

dk01's picture

He has: 516 posts

Joined: Mar 2002

Instead of using bordercolor add a css style. That is standards.
-dk

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Quote: Originally posted by Renegade
it's annoying how ie supports so many things that others don't, things that aren't standard...

heh, Renegade, baby, you got that all turned around! IE doesn't "support" so many things, it has added a bunch of stuff that isn't in the standards. This is how the web originally got pushed forward, the Browser Wars, introducing new elements and attributes willy nilly. With the introduction of standards, the best items (or most of them) were adopted into standards, and the crap was jettisoned. IE still supports the crap.

So does Netscape, for its own crap.

Some of the new things that aren't in the current standards that browsers introduce eventually get their way INTO the standards, then the other guys have to support them.

For the most part, though, anything that is proprietary can be replaced using standards, just not quite so easily. The advantage is that it works for more browsers and other software applications that "read" information from the web.

I do believe, however, that if it's not going to hurt other applications (by crashing them or obfuscating the information), then using some of the proprietary items is a choice people can make on a case-by-case basis. I won't do it because it makes my life difficult. Wink But if you choose to do it, that's your choice, and all the more power to you for making it.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Quote: Originally posted by NYColt

STYLES

table#demo {
border-top: 7px #90924C solid;
border-bottom: 7px #90924C solid;
border-right: 7px #454632 solid;
border-left: 7px #A7A96F solid;
height: 80%;
width: 70%;
-moz-opacity: 60%;
filter: alpha(opacity=60);
}

HTML

***********

Other than the opacity issues, that's all standards. You can move the borders around so the colours are right (the IE dark, light, blah blah attributes are just to determine the edges of the table).

hth!

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.