Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Overlay Transparent Image

Posted on 2010-09-06
5
Medium Priority
?
405 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses how to implement server side field validation and display customized error messages to the client.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

618 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