CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 22nd, 2002, 06:14 AM
atticweb atticweb is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 2 atticweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
CSS color background transparent

I have a menu in a table. There's a background image on the page and I want to colour the table cells but still see the background thru the cell. i know there is color background transparent in CSS but can you make the transparent a %??
Jim

Reply With Quote
  #2  
Old October 22nd, 2002, 11:54 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 13
Send a message via AIM to bricker42
Not without making everything in the table (the text and stuff) transparent as well. You could try floating a div behind the table and putting the transparent image in there, but it probably isn't worth it .

Reply With Quote
  #3  
Old October 22nd, 2002, 02:37 PM
atticweb atticweb is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 2 atticweb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks for the response anyway

jim

Reply With Quote
  #4  
Old October 22nd, 2002, 02:55 PM
Tuxie Tuxie is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: Inside the GNU/Hurd kernel
Posts: 492 Tuxie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 1 m
Reputation Power: 12
You can use a transparent PNG as background.

Reply With Quote
  #5  
Old October 22nd, 2002, 03:40 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 13
Send a message via AIM to bricker42
If you go that route, you'll need to fake IE. Here's some code that helps with that:
http://www.youngpup.net/?request=/snippets/sleight.xml

Note that this only works for ie5.5+. I don't think ie5.0 supports alpha channels.

Last edited by bricker42 : October 22nd, 2002 at 03:43 PM.

Reply With Quote
  #6  
Old October 22nd, 2002, 07:14 PM
adios adios is offline
Senior Citizen
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2001
Location: leftcoast
Posts: 2,019 adios User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 15
Try this:


<html>
<head>
<title>untitled</title>
<style type="text/css">

table {
background: pink;
filter: alpha(opacity=50);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
-moz-opacity: 50%;
}

td {
position: relative;
width: 80px;
font: 200 10px verdana;
text-align: center;
border: 2px salmon solid;
}

.menu {
position: absolute;
left: 0px;
top: 0px;
width: 82px;
font: 200 10px verdana;
color: #440000;
text-align: center;
border: 1px black solid;
cursor: hand;
}

body {
text-align: center;
margin-top: 94px;
background: url(http://216.40.241.209/textures/misc/misc059.gif);
}

</style>
<script type="text/javascript" language="javascript">

// mouseover - no additional cost...
var tds = document.getElementsByTagName('td');
onload = function() {
var c, i =0;
while (c = tds.item(i++)) {
c.onmouseover = function() {this.style.background='salmon';}
c.onmouseout = function() {this.style.background='transparent';}
}
}

</script>
</head>
<body>
<div style="width:360px;border:3px black double;">
<table>
<tr>
<td><span class="menu">choice 1</span>choice 1</td>
<td><span class="menu">choice 2</span>choice 2</td>
<td><span class="menu">choice 3</span>choice 3</td>
<td><span class="menu">choice 4</span>choice 4</td>
</tr><tr>
<td><span class="menu">choice 5</span>choice 5</td>
<td><span class="menu">choice 6</span>choice 6</td>
<td><span class="menu">choice 7</span>choice 7</td>
<td><span class="menu">choice 8</span>choice 8</td>
</tr><tr>
<td><span class="menu">choice 9</span>choice 9</td>
<td><span class="menu">choice 10</span>choice 10</td>
<td><span class="menu">choice 11</span>choice 11</td>
<td><span class="menu">choice 12</span>choice 12</td>
</tr>
</table>
</div>
</body>
</html>


There may be another way to override inheritance of an alpha filter than using positioned elements, but I haven't seen it (yet).

Alpha filters have been supported since IE4.

Last edited by adios : October 23rd, 2002 at 12:37 AM.

Reply With Quote
  #7  
Old October 22nd, 2002, 11:35 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 13
Send a message via AIM to bricker42
adios: that is awsome!

Doesn't work in mozilla, though... (v. 1.2a ).

Reply With Quote
  #8  
Old October 22nd, 2002, 11:44 PM
adios adios is offline
Senior Citizen
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jan 2001
Location: leftcoast
Posts: 2,019 adios User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 15
(I liked the first part of your post better)

Been fooling with this:


<html>
<head>
<title>untitled</title>
<style type="text/css">

table {
background: #9999cc;
filter: alpha(opacity=44);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=44);
-moz-opacity: 44%;
}

td {
position: relative;
width: 78px;
font: 200 12px "comic sans ms";
color: #000000;
text-align: center;
border: 1px #000066 solid;
}

.menu {
position: absolute;
left: 0px;
top: 0px;
width: 80px;
font: 200 12px "comic sans ms";
color: #ffffff;
text-align: center;
cursor: hand;
}

body {
margin-top: 60px;
margin-left: 0px;
overflow: hidden;
background: url(http://216.40.241.209/textures/lblue/lblue064.jpg);
}

</style>
<script type="text/javascript" language="javascript">

var tds = document.getElementsByTagName('td');
onload = function() {
var c, i =0;
while (c = tds.item(i++)) {
c.onmouseover = function() {this.style.background='#000066';}
c.onmouseout = function() {this.style.background='transparent';}
}
}

</script>
</head>
<body>
<div style="width:88px;border-top:4px #6666aa groove;border-bottom:4px #6666cc groove;border-right:4px #6666cc groove;">
<table>
<tr>
<td><span class="menu">choice 1</span>choice 1</td>
</tr><tr>
<td><span class="menu">choice 2</span>choice 2</td>
</tr><tr>
<td><span class="menu">choice 3</span>choice 3</td>
</tr><tr>
<td><span class="menu">choice 4</span>choice 4</td>
</tr><tr>
<td><span class="menu">choice 5</span>choice 5</td>
</tr><tr>
<td><span class="menu">choice 6</span>choice 6</td>
</tr><tr>
<td><span class="menu">choice 7</span>choice 7</td>
</tr><tr>
<td><span class="menu">choice 8</span>choice 8</td>
</tr><tr>
<td><span class="menu">choice 9</span>choice 9</td>
</tr>
</table>
</div>
</body>
</html>


How 'bout that 19¢ drop-shadow?

Don't have moz here at the moment - is it the opacity that's not happening? Oh, well...

...seen this?

Last edited by adios : October 23rd, 2002 at 12:38 AM.

Reply With Quote
  #9  
Old October 23rd, 2002, 12:15 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 13
Send a message via AIM to bricker42
That's pretty sweet. I tried for awhile to get that effect with a dropdown menu, but it kept going all googly.

As for your code in mozilla, mozilla is smarter than ie . It doesn't forget the opacity, and it doesn't lose the rollover background (odd that). So everything within the cells is transparent, and once the background color changes it stays stuck.

** edit **
What would be really nice would be if you could set the opacity to 120%.

Reply With Quote
  #10  
Old October 23rd, 2002, 11:44 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 13
Send a message via AIM to bricker42
Check it out. Tested in moz 1.1b and ie5.0.

Code:
<html>
<head>
<title>untitled</title>
<style type="text/css">

table {
background: pink;
filter: alpha(opacity=50);
filter: progid:DXImageTransform.Microsoft.Alpha(opacity=50);
-moz-opacity: 50%;
}

td {
position: relative;
width: 80px;
font: 200 10px verdana;
text-align: center;
border: 2px salmon solid;
}

.menu {
position: absolute;
font: 200 10px verdana;
color: #440000;
text-align: center;
text-decoration: none;
background:transparent;
}
.menu:hover {
	background:salmon;
	color: #884444;
}

body {
text-align: center;
margin-top: 94px;
background: url(http://216.40.241.209/textures/misc/misc059.gif);
}

</style>
<script type="text/javascript" language="javascript">

// mouseover - no additional cost...
var tds = document.getElementsByTagName('td');
onload = function() {
	var c, i =0;
	while (c = tds.item(i++)) {
		d = document.getElementById( 'container' );
		e = document.createElement( "a" );
		e.setAttribute( "href", "link" + i + ".html" );
		e.className = "menu";
		e.style.left = c.offsetLeft;
		e.style.top = c.offsetTop;
		e.style.width = c.offsetWidth;
		e.style.height = c.offsetHeight;
		e.style.display = "block";
		e.style.position = "absolute";
		e.innerHTML = c.innerHTML;
		c.innerHTML = "&nbsp;";
		d.appendChild( e );
	}
}

</script>
</head>
<body>
<div style="width:360px;border:3px black double;">
<table>
<tr>
<td>choice 1</td>
<td>choice 2</td>
<td>choice 3</td>
<td>choice 4</td>
</tr><tr>
<td>choice 5</td>
<td>choice 6</td>
<td>choice 7</td>
<td>choice 8</td>
</tr><tr>
<td>choice 9</td>
<td>choice 10</td>
<td>choice 11</td>
<td>choice 12</td>
</tr>
</table>
</div>
<div id="container"></div>
</body>
</html>


Next step is to see if I can steal a link node from inside the td and just change its parent.

Last edited by bricker42 : January 1st, 2003 at 02:12 PM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS color background transparent

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap