Solved

Overlay Transparent Image

Posted on 2010-09-06
5
390 Views
Last Modified: 2012-05-10
I have a php page that creates a schedule of classes as a table.  On that page, i would like to overlay the word "Cancelled" over the class name (in that cell), if the scheduling person cancels the class. (There would be an indicator field in the query that denotes the class is cancelled).  The schedule is done using a table that can grow and shrink based on the number of classes returned by the query to the database.  When the canceled indicator is set, I'd like the word "Cancelled" to be overlayed on the class name, but be transparent so you can still see the class name.  
I've searched the archives but haven't come up with anything.
My thought is to use a "DIV" somehow in the table cell where there is an if statement that would add the overlay.
Would greatly appreciate some help in figuring this out.
If you need any more info, please ask and I will try to provide it.

Thanks In Advance,
OldHatt45
0
Comment
Question by:OldHatt45
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:ovi_mihai
ID: 33613042
try this.

it could have some problems with IE

I put a rotation too. on Firefox it looks great
<html>

<style>
td{font-size:30px;}
.trans{
position:absolute;
top:10px;
color: #17ADD7;
background: transparent;
filter: alpha(opacity= 50);
-moz-opacity: .50;
opacity: .50;

-webkit-transform: rotate(-15deg); 
-moz-transform: rotate(-15deg);	
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=4);
}
</style>
<body>
<table>
<tr>
	<td>content</td>
	<td>Class Name
		<div class="trans">CANCELED</div>
	</td>
	<td>content</td>
</tr>
<tr>
	<td>content</td>
	<td>content</td>
	<td>content</td>
</tr>

</table>
</body>
</html>

Open in new window

0
 
LVL 34

Accepted Solution

by:
Slick812 earned 500 total points
ID: 33613137
greetings OldHatt45, , You might try two DIV, the outer with a RELATIVE style position, and the inner one with the canceled (text or image) with a ABSOLUTE style position.
In my table code below the
<div style="position:relative;">
and
<div style="color:f00;position:absolute;top:10px;left:10px;width:120;height:30px;">
may do something like what you need, adjusting the width and height to suit your needs
<table width="520" border="1">
<tr><td style="width:140px;">Class 101<br />intro PHP</td><td width="220">description of course</td><td>time 9:00 AM</td></tr>
<tr><td style="width:140px;"><div style="position:relative;">Class 102<br />mid PHP<div style="color:f00;position:absolute;top:10px;left:10px;width:120;height:30px;">CANCELED</div></div></td><td width="220">description</td><td>time 11:00 AM</td></tr>
<tr><td style="width:140px;">Class 103<br />advanced PHP</td><td width="220">description</td><td>time 2:00 PM</td></tr></table>

Open in new window

0
 

Author Comment

by:OldHatt45
ID: 33613143
ovi_mihai:

Interesting.  It does in fact do an overlay.
But if i simply add <div class="trans">Canceled</div> inside the second <td> in the second row, it does not place the Canceled text overlay in the correct cell.  It puts it in what looks like an absolute position.

I need it to go in the specific cell (with the class name) which could be row 2 or maybe row 10  or some other row, depending on the "canceled indicator" returned.  

I think the style that you created is using an absolute position which appears to be absolute to the screen and not absolute to the table cell.

Any other ideas????

Thanks,
OldHatt45
0
 
LVL 3

Expert Comment

by:ovi_mihai
ID: 33619744
try like Slick812 said.. with position: relative;

if it would be possible.. I recomand you to calculate the position it should be..
maybe you can make the table more stable.. fixed widths would be a big plus.

you will anyway have problems with diferent browsers
0
 

Author Closing Comment

by:OldHatt45
ID: 33620379
Well done and SIMPLE!
Works lke a charm.

Thanks,
OldHatt45
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PHP Installer 5 37
display balance of stars as greyed out 8 23
PHP breaks when used in Wordpress template file 3 30
ajax to record click 3 16
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question