Solved

Overlay Transparent Image

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

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

744 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now