Solved

Overlay Transparent Image

Posted on 2010-09-06
5
398 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 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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

724 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