Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-11-2007, 07:53 PM   PM User | #1
oliver111
New Coder

 
Join Date: Aug 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
oliver111 is an unknown quantity at this point
Can't do background transparency on DIV..

Now the question is, how do i get the background colour to be 45% transparent as i have another background inplace.

#content {
padding:0px 5px 5px 5px;
border-left:solid 1px #FFFFFF;
border-right:solid 1px #FFFFFF;
border-bottom:solid 1px #FFFFFF;
margin:0 auto;
text-align:center;
width:623px;
height:auto;
background-color:#000000;

}

Now the question is, how do i
oliver111 is offline   Reply With Quote
Old 09-11-2007, 08:06 PM   PM User | #2
oliver111
New Coder

 
Join Date: Aug 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
oliver111 is an unknown quantity at this point
Another thing too, i don't want the text to be transparent just the background.
oliver111 is offline   Reply With Quote
Old 09-11-2007, 08:07 PM   PM User | #3
eak
Regular Coder

 
eak's Avatar
 
Join Date: Jun 2002
Location: Nashville, TN
Posts: 354
Thanks: 0
Thanked 26 Times in 26 Posts
eak is on a distinguished road
Code:
#content {
padding:0px 5px 5px 5px;
border-width:0 1px 1px 1px;
border-style:solid;
border-color:#FFF;
margin:0 auto;
text-align:center;
width:623px;
height:auto;
background-color:#000000;
opacity:.45;
}
until rgba color is widely supported, you will have to overlay a div on top of your semi-transparent background to have non-transparent text.
Or, you can use a png image with alpha transparency for your semi-transparent background.
__________________
eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

Last edited by eak; 09-11-2007 at 08:10 PM..
eak is offline   Reply With Quote
Old 09-11-2007, 08:14 PM   PM User | #4
oliver111
New Coder

 
Join Date: Aug 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
oliver111 is an unknown quantity at this point
Thanks but i can't overlay for some reason, z-index won't do it properly and the position seems to place it off the design.
oliver111 is offline   Reply With Quote
Old 09-11-2007, 08:30 PM   PM User | #5
oliver111
New Coder

 
Join Date: Aug 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
oliver111 is an unknown quantity at this point
It seems css has been really crap then, is there not back-ground-color-opacity or anything like that? I tried overlaying the div but it doesn't work the text still goes in with the transparncy.
oliver111 is offline   Reply With Quote
Old 09-11-2007, 08:40 PM   PM User | #6
eak
Regular Coder

 
eak's Avatar
 
Join Date: Jun 2002
Location: Nashville, TN
Posts: 354
Thanks: 0
Thanked 26 Times in 26 Posts
eak is on a distinguished road
back-ground-color-opacity doesn't exist.

What does exist is rgba() in css3 (see http://www.w3.org/TR/css3-color/).
rgba takes 4 arguments: red, green, blue, and alpha (transparency #).

For now, I would go with a semi-transparent png background image to get the effect you want. It will not work in IE6 unless you use some hacks. Every other browser can render png's just fine.
__________________
eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."
eak is offline   Reply With Quote
Old 09-11-2007, 08:42 PM   PM User | #7
oliver111
New Coder

 
Join Date: Aug 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
oliver111 is an unknown quantity at this point
I can't go with images, because the heigths and widths are automatic for the many pages on the website.
oliver111 is offline   Reply With Quote
Old 09-11-2007, 08:47 PM   PM User | #8
eak
Regular Coder

 
eak's Avatar
 
Join Date: Jun 2002
Location: Nashville, TN
Posts: 354
Thanks: 0
Thanked 26 Times in 26 Posts
eak is on a distinguished road
Do you have an example online somewhere?

What have you done so far?

see http://css.dev.ericking.us/ for a quick example I made.
__________________
eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

Last edited by eak; 09-11-2007 at 08:57 PM.. Reason: added link
eak is offline   Reply With Quote
Old 09-11-2007, 09:17 PM   PM User | #9
oliver111
New Coder

 
Join Date: Aug 2007
Posts: 34
Thanks: 0
Thanked 0 Times in 0 Posts
oliver111 is an unknown quantity at this point
How did you get the background like that everytime i try that i get horrid pixles in the transparncy i worked out how to get the background on just getting the img right. I use Cs2 abobe btw, thanks for the help btw.
oliver111 is offline   Reply With Quote
Old 09-11-2007, 09:33 PM   PM User | #10
rmedek
Senior Coder

 
Join Date: Nov 2003
Location: Minneapolis, MN
Posts: 2,879
Thanks: 2
Thanked 65 Times in 56 Posts
rmedek is on a distinguished road
Oliver, please check your Private Messages.
__________________
drums | web
rmedek is offline   Reply With Quote
Old 09-11-2007, 09:47 PM   PM User | #11
eak
Regular Coder

 
eak's Avatar
 
Join Date: Jun 2002
Location: Nashville, TN
Posts: 354
Thanks: 0
Thanked 26 Times in 26 Posts
eak is on a distinguished road
The background is a black 1x1 pixel image with the layer opacity dropped down.
Save for web as a PNG-24, not gif.
__________________
eak | "Doing a good deed is like wetting your pants; every one can see the results, but only you can feel the warmth."

Last edited by eak; 09-11-2007 at 09:51 PM..
eak is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:28 AM.


Advertisement
Log in to turn off these ads.