|
|
|||||||||
|
|||||||||
|
|||||||||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
positioning text over an image
I am trying to position text over an image in a column of a table. I have placed the code below: What happens is a blank line appears in the table displacing the image.
This is the code: <table> <TR> <TD ></TD> <TD width="300" align="left"><IMG SRC="../../templates/nature/images/menubox_02.gif" WIDTH=300 HEIGHT=41 ALT=""> <div id="Layer1" style="position:relative; width:287px; height:23px; z-index:2; left: 47px; top: 36px;">Needlepoint Shop Guilford</div> </td> URL How do I go about writing the code to eliminate the white line and place the text over the image? ![]() |
|
#2
|
||||
|
||||
|
Try setting you layer to "position: absolute"
|
|
#3
|
||||
|
||||
|
putting the image in a layer as well might help for your positioning...
not a requirement, just a suggestion... there's a big movement trying abolish the use of tables =) instead using CSS and <div>'s for layout positioning |
|
#4
|
|||
|
|||
|
I suppose that is the question.
|
|
#5
|
|||
|
|||
|
Quote:
Here's my way: Code:
<table width="300" height="41" cellpadding="0" cellspacing="0" border="0" style="background-image: url('../../templates/nature/images/menubox_02.gif')>
<TR>
<TD width="300" align="left">
<div id="Layer1" style="position:relative; width:287px; height:23px; z-index:2; left: 47px; top: 36px;">Needlepoint Shop Guilford</div>
</td></tr></table>
It worked for me =) |
|
#6
|
||||
|
||||
|
Here's the more correct, standards-based way of doing it:
Code:
<style type="text/css">
#outter {
width : 400px;
height : 80px;
padding : 0;
margin : 0;
background-image: url(your image);
border : 1px solid green;
position : relative;
}
#inner {
position:absolute;
z-index : 2;
left: 50%;
top: 50%;
border : 1px solid blue;
margin-top : -10px;
margin-left : -75px;
}
</style>
<div id="outter">
<div id="inner">Needlepoint Shop Guilford</div>
</div>
|
|
#7
|
|||
|
|||
|
Quote:
Thanks ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Web Design > Web Development > positioning text over an image |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|