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!

Problem with extra space above DIV 1

Status
Not open for further replies.

Gatorajc

MIS
Mar 1, 2002
423
US
I have a div that is inside a cell of a table. These are the specs

#CellDiv {
border:0px solid black;
height:100%;
width:100%;
overflow:auto;
}

For some reason I get a extra space right above it. This is the code for the cell.

<td width=&quot;24%&quot; valign=&quot;top&quot; bgcolor=&quot;#FFFFFF&quot;>
<div id=&quot;CellDiv&quot;>

<table width=&quot;100%&quot; height=&quot;78&quot; border=&quot;1&quot; align=&quot;center&quot; bordercolor=&quot;#000000&quot;>
<tr valign=&quot;top&quot;>
<td height=&quot;23&quot; colspan=&quot;2&quot;> <div align=&quot;center&quot;><strong>
<font color=&quot;#FF0000&quot;><em>Upcoming Expirations</em></font></strong></div>
</td></tr>

<tr valign=&quot;top&quot;>
<td height=&quot;23&quot;><em><strong><font color=&quot;#6699CC&quot;>Date</font></strong></em></td>
<td><em><strong><font color=&quot;#6699CC&quot;>Contract Name</font></strong></em></td>
</tr>
<% Do While Not RS1.EOF %>
<tr valign=&quot;top&quot;>
<td width=&quot;54&quot; height=&quot;22&quot;>
<% Response.write RS1(&quot;ContractExpiration&quot;)%>
</td>
<td> <div class=&quot;BLACK&quot;><A Href=&quot;servicecalendar.asp?recdate=<%= RS1(&quot;ContractExpiration&quot;)%>&quot;>
<% Response.write RS1(&quot;ContractName&quot;)%>
</A></div></td>
</tr>
<% RS1.MoveNext
loop
%>
</table>
</div></td>


For some reason it gives me a big extra space sometimes right above the table in the Div tag.
AJ
[americanflag]


 
check your cellpadding and cellspacing for the tables. They have a default value so you need to set them to zero to eliminate any space in them.


É ::
 
Thanks but neither worked. I already thought of the padding but knew it could not be that because the it is a pretty big space.
AJ
[americanflag]


 
Hi mate
This may sound weird but I promise you I've had it before. This may not be the case for you of course.

The whitespace between your div line and table line may be rendering, even though it shouldn't.
Try putting it all on one line like this.

<div id=&quot;CellDiv&quot;><table width=&quot;100%&quot; height=&quot;78&quot; border=&quot;1&quot; align=&quot;center&quot; bordercolor=&quot;#000000&quot;>

You never know, it might just work.

Maybe even put it all on the same line with the td tag aswell. Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
I tried that before and it didnt work but when I first read your post I kind of glanced at it and thought you meant put in an extra table. (Don't ask how I got that from your post but I did, I have to improve my reading skills) So I put a simple table like this one

<table width=&quot;100%&quot; height=&quot;2&quot; border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr><td>&nbsp;</td></tr></table>

and it started working like it should. If I take it out it screws up again. STRANGE how these things work sometimes. Anyway thanks for the help.
AJ
[americanflag]


 
No probs, thanks for the star!
[wiggle] Hope I helped / Thanks for helping
if ((Math.abs(x)<10&&Math.abs(y)<10) && (((parseInt(Math.abs(x).toString()+Math.abs(y).toString())-Math.abs(x)-Math.abs(y))%9)!=0)) {alert(&quot;I'm a monkey's uncle&quot;);}
 
hallo,
another solution could be to position your div absolutely within the corner using styles...

glad it worked out.

zpie
 
Another solution would be to use a SPAN instead of a DIV.

SPANs work the same as DIVs, but without inserting an extra blank line.

dolphyn
 
div's don't insert any other lines, they just take up the full line they are in, they are block level elements.
span is inline, so as long as there is no other elements in the cell with them they they will basically behave the very same.


É ::
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top