Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

position:absolute;

Status
Not open for further replies.

andycape

Programmer
Aug 22, 2003
177
ZA
I have the following scenario :
<table>
<tr>
<td> Picture here </td>
<td> writing here </td>
</tr>
</table>

The pictue is leaving a tiny space to the left, I was looking for a way to get it to leave no spaces (Padding 0; Margin 0; in body tags isnt working)

Going through the FAQ's I found the following to use on the image, it sorts out the problem with the image but also moves my text across to the left.

<img src="Imagename.bmp" style="position:absolute; left:0; top:0;" border="0">

Is there a way that it will only effect the image and not the text aswell ?

I heard you could put the whole page in a div ??

Thanx.
 
Don't use absolute positioning for that purpose.
If there is any space between <td> and <img>, remove it.
If this doesn't work - please send page code (stripped to necessary details if possible) then we'll see what's going on.
 
Code:
<body bgcolor="#EEEDC8" topmargin="0" leftmargin="0">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
    <td valign="top"><img src="/Images/Untitled2.jpg" WIDTH=180 HEIGHT=690 alt=""></td>
    <td>

	<br>
	<h2><strong>Contact Us</strong></h2>
		<table cellspacing="0" cellpadding="0" border="0">
		<tr>
			<td> Stuff in this table </td>
		</tr>
		</table>
    </td>
</tr>
</table>
</body>
</html>

The untitled pic is in the one <td> and the table with writing is in the other.
 
Just checked - without any intervention it looks OK.

Insert this CSS temporarily. It helps to "debug" layout:
Code:
<style type="text/css">
table {	border: solid red 1px; }
td {	border: solid green 1px; }
img {	border: solid blue 1px; }
</style>
Normally there should be no gaps between lines to the left. Some other possibilities:

- older versions of Netscape (recognize only BODY marginheight="0" marginwidth="0"). Probably not but anyway...
- tiny space is actually part of picture (transparent or same color as background)
- if you are using external CSS also check for rules that apply to BODY, IMG or TD tag.
 
... or simply use the image as a background on the one table cell -defining the height and with of the cell accordingly.


Jakob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top