Reply
CSS - layer on a layer - is transparency possible?
Old 02-23-2007, 07:48 AM CSS - layer on a layer - is transparency possible?
Average Talker

Posts: 16
I've a layer containing a SWF that I want to be visible on top of another text layer in CSS.

Trouble is that the layer appears like a white block with my SWF in it over the text. I'd like the white in my SWF layer to be transparent so I can see the text beneath it.
Is this possible in CSS?
Bansaw is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 02-23-2007, 11:06 AM Re: CSS - layer on a layer - is transparency possible?
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,945
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
You can use absolute positioning and the z-index property to accomplish that.

z-index allows stacking of elements on top of one another. The higher the z-index, the closer to the foreground the object becomes (the default for all elements is 0).

http://www.w3schools.com/css/pr_pos_z-index.asp
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 02-23-2007, 11:40 AM Re: CSS - layer on a layer - is transparency possible?
LadynRed's Avatar
Super Moderator

Posts: 6,570
Location: Tennessee
Change your publish settings in Flash so that it generates the SWF as 'windowless transparent'. That will get rid of the white block.
Then, if you still need it, you can use Adam's solution.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 02-23-2007, 12:06 PM Re: CSS - layer on a layer - is transparency possible?
Average Talker

Posts: 16
Thanks, tried the z-index (below). Didn't work.
My SWF layer is layer13 and my text layer is layer1.
I want my text to appear over my SWF.

I have made my SWF transparent. (param name="wmode" value="transparent") etc.



Quote:
#layer1 { font-family: Helvetica, Geneva, SunSans-Regular, sans-serif, "Arial Narrow"; font-size: 8pt; font-weight: normal; height: 390px; width: 240px; left: 570px; top: 120px; position: absolute; visibility: visible; z-index=1; }
@font-face{ font-family: "Arial Narrow"; font-size: 10; font-variant: normal; }

#layer12 { height: 80px; width: 110px; left: 420px; top: 430px; position: absolute; visibility: visible; z-

index=2; }
#layer2 { height: 50px; width: 260px; left: 575px; top: 552px; position: absolute; visibility: visible; z-

index=3; }
#layer3 { height: 701px; width: 913px; left: 0; top: 0; position: absolute; visibility: visible; z-index=4; }
#layer5 { height: 100px; width: 310px; left: 460px; top: 50px; position: absolute; visibility: visible; z-

index=5; }
#layer6 { height: 60px; width: 115px; left: 245px; top: 60px; position: absolute; visibility: visible; z-index=6;

}
#layer7 { height: 60px; width: 115px; left: 134px; top: 115px; position: absolute; visibility: visible; z-

index=7; }
#layer8 { height: 60px; width: 115px; left: 71px; top: 201px; position: absolute; visibility: visible; z-index=8;

}
#layer9 { height: 60px; width: 115px; left: 72px; top: 304px; position: absolute; visibility: visible; z-index=9;

}
#layer10 { height: 60px; width: 115px; left: 135px; top: 390px; position: absolute; visibility: visible; z-

index=10; }
#layer11 { height: 60px; width: 115px; left: 246px; top: 440px; position: absolute; visibility: visible; border-

width: 0; border: 0pt z-index=11; }
#layer4 { height: 260px; width: 340px; left: 230px; top: 160px; position: absolute; visibility: visible; z-index=12; }

#layer13 { height: 120px; width: 120px; left: 780px; top: 50px; position: absolute; visibility: visible; z-index=13; }
Bansaw is offline
Reply With Quote
View Public Profile
 
Old 02-23-2007, 03:53 PM Re: CSS - layer on a layer - is transparency possible?
LadynRed's Avatar
Super Moderator

Posts: 6,570
Location: Tennessee
OMG

First of all, absolutely positioning ALL of those elements ( they are NOT LAYERS) is just not necessary and it's going to cause you a lot of problems.

If you want your SWF to be on top, give it a z-index of 200. However I suspect there are other things going on there that is causing your problem.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 02-24-2007, 02:55 AM Re: CSS - layer on a layer - is transparency possible?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,024
Name: Forrest Croce
Location: Seattle, WA
Whether you want to call them layers or divs, give them each a name. Seriously, it will make things so much easier for you. I'm having a hard time figuring out what's going on in your code; that must be a pain to work with? They don't have to be good names, swf and textUnderSwf.

If the first div goes on the top, and the next one below it, or basically the elements aren't covering each other, you don't need to assign them a z-index. That only comes into play when two elements could cover each other.

Set visibility: visible; at the html level. That will make it like a default, so you don't have to repeat it in all of your rules.
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 02-24-2007, 10:34 AM Re: CSS - layer on a layer - is transparency possible?
LadynRed's Avatar
Super Moderator

Posts: 6,570
Location: Tennessee
visibility: visible isn't necessary, as everything is visible by default anyway.
The stacking order is from the bottom UP. It would be better to use the normal document flow, floats and then only use absolute positioning where ..well absolutely necessary.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!
"Using or working with IE is like having to wear a 1970's polyester suit with pantyhose and a girdle, to work everyday"
Carolina Corvette Club
LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to CSS - layer on a layer - is transparency possible?
 

Thread Tools

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.14841 seconds with 12 queries