Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > HTML > HTML Code Clinic
|
HTML Code Clinic Do you have some HTML code you'd like to share and get suggestions from others for tweaking or improving it? This discussion is the place.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the HTML Code Clinic section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 14th, 2003, 11:52 AM
Authorized User
 
Join Date: Jun 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default Overlay Text on graphic

Hello -

I'm trying to display graphical headers above each section of my page. These headers are basically just a rectangular graphic with a space for text in them. As of now I'm using a graphic editing program to overlay a textbox with the relevant heading title and then saving the new graphic as a gif.

I would really like to make one graphic with a blank spot for the title and then fill in the title within my page with a database query. Is there any kind of support for this in HTML or JavaScript for that matter.

Thanks,
Mike
 
Old July 14th, 2003, 02:42 PM
Authorized User
 
Join Date: Jul 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bosboom
Default

You can use layers;
define <style> - definition

<style>
.overall {
    position : relative;
    left : 0;
    top : 0;
}
.overlay {
    position : absolute;
    // define position of text
    left : 3;
    top : 4;
}
</style>

<div class="overall">
    <img src="yourimage goes here">
    <div class="overlay">Your text</div>
</div>

Works in both IE and NS

GreetZ,

Bosboom

 
Old July 14th, 2003, 03:47 PM
Authorized User
 
Join Date: Jun 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried using that code but the text ends up showing up next to the image, not on top of it. I've tried changing the absolute and relative values in each class but all that does is change the text from being to right of the image to being below it.

Have you ever seen this behavior?

Mike
 
Old July 15th, 2003, 01:53 AM
Authorized User
 
Join Date: Jul 2003
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to bosboom
Default

You probably did copy the code with the comment

// define position of text

DELETE THIS LINE!!!

Then it works fine...

 
Old July 15th, 2003, 08:10 AM
Authorized User
 
Join Date: Jun 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That was it. I'm so used to C and Java code that I didn't even think about the different comment syntax.

Thanks a million.

-Mike





Similar Threads
Thread Thread Starter Forum Replies Last Post
Looking to overlay a pic on a web page Concept Javascript How-To 0 May 17th, 2008 04:21 AM
Graphic Validation chemi J2EE 0 January 3rd, 2006 01:00 PM
Graphic disapeared vnt C# 0 May 25th, 2005 07:47 PM
How to interpret a graphic ? faridahhani BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 June 19th, 2003 04:39 AM
graphic to text faridahhani C# 0 June 19th, 2003 03:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.