Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > HTML Query

Reply
Thread Tools

HTML Query

 
 
Jon
Guest
Posts: n/a
 
      07-27-2003
Hi, I'm pretty good normally with HTML, but for some reason I'm blind as to
why the following code doesn't work:

<html>
<head>
<body topmargin=0 marginheight=0 leftmargin=0>
<table cellpadding=0 cellspacing=0 width=100% border=0>
<tr height=2>
<td bgcolor=black width=100% height=2>
</td>
<td bgcolor=#666666 height=2>
<img src="spacer.gif" width=190 height=2>
</td>
</tr>
</table>
</html>


I simply want a 2 pixel high bar across the screen with the last 190 pixels
being grey and the rest black. spacer.gif is a 1x1 pixel transparent gif.

Instead of being 2 pixels high, it is (I think) 18 pixels high, and I can't
seem to find any way of making it smaller.

Cheers


 
Reply With Quote
 
 
 
 
Nick Howes
Guest
Posts: n/a
 
      07-27-2003
> <html>
> <head>
> <body topmargin=0 marginheight=0 leftmargin=0>
> <table cellpadding=0 cellspacing=0 width=100% border=0>
> <tr height=2>
> <td bgcolor=black width=100% height=2>
> </td>
> <td bgcolor=#666666 height=2>
> <img src="spacer.gif" width=190 height=2>
> </td>
> </tr>
> </table>
> </html>
>
>


I can't vouch for other browsers, you'd have to try it, but in IE6 it works
to keep each cell on one line with no gaps like so:

<td bgcolor=black width=100% height=2></td>
<td bgcolor=#666666 height=2><img src="spacer.gif" width=190
height=2></td>

because line breaks and returns are often interpreted as a single space
character (intented so that you can put line breaks in a paragraph of text
to keep your source looking neat), which will try to fit in the table thus
stretching it vertically.

--
Nick Howes


 
Reply With Quote
 
 
 
 
Dan Brussee
Guest
Posts: n/a
 
      07-27-2003
In article <3f23e2fc$0$11381$(E-Mail Removed)>,
http://www.velocityreviews.com/forums/(E-Mail Removed) says...
> Hi, I'm pretty good normally with HTML, but for some reason I'm blind as to
> why the following code doesn't work:
>
> <html>
> <head>
> <body topmargin=0 marginheight=0 leftmargin=0>
> <table cellpadding=0 cellspacing=0 width=100% border=0>
> <tr height=2>
> <td bgcolor=black width=100% height=2>
> </td>
> <td bgcolor=#666666 height=2>
> <img src="spacer.gif" width=190 height=2>
> </td>
> </tr>
> </table>
> </html>
>
>
> I simply want a 2 pixel high bar across the screen with the last 190 pixels
> being grey and the rest black. spacer.gif is a 1x1 pixel transparent gif.
>
> Instead of being 2 pixels high, it is (I think) 18 pixels high, and I can't
> seem to find any way of making it smaller.


I agree with the other poster - keep the <td> and </td> on the same line
with no gaps. A new line in HTML is treated as a space, so you are
forcing the td height to be at least as tall as a character in the font
chosen.



--

Remove NOT from email address to reply. AntiSpam in action.
 
Reply With Quote
 
Robert Frost-Bridges
Guest
Posts: n/a
 
      07-27-2003
On Sun, 27 Jul 2003 15:33:55 +0100, "Jon" <(E-Mail Removed)> wrote:

>Hi, I'm pretty good normally with HTML, but for some reason I'm blind as to
>why the following code doesn't work:


[snip code]

Good advice on the whitespace so far. You can also lose the height
attribute for your table row as it doesn't exist.
http://www.w3.org/TR/1998/REC-html40...s.html#edef-TR

It is also recommended that attributes are delimited using quotation
marks.
http://www.w3.org/TR/1998/REC-html40...dx-attribute-6


--
frostie
http://www.brightonfixedodds.com
 
Reply With Quote
 
Richard
Guest
Posts: n/a
 
      07-28-2003

"Jon" <(E-Mail Removed)> wrote in message
news:3f23e2fc$0$11381$(E-Mail Removed) ...
> Hi, I'm pretty good normally with HTML, but for some reason I'm blind as

to
> why the following code doesn't work:
>
> <html>
> <head>
> <body topmargin=0 marginheight=0 leftmargin=0>
> <table cellpadding=0 cellspacing=0 width=100% border=0>
> <tr height=2>
> <td bgcolor=black width=100% height=2>
> </td>
> <td bgcolor=#666666 height=2>
> <img src="spacer.gif" width=190 height=2>
> </td>
> </tr>
> </table>
> </html>
>
>
> I simply want a 2 pixel high bar across the screen with the last 190

pixels
> being grey and the rest black. spacer.gif is a 1x1 pixel transparent gif.
>
> Instead of being 2 pixels high, it is (I think) 18 pixels high, and I

can't
> seem to find any way of making it smaller.
>
> Cheers
>


Why do you have cell #1 width set to 100%??
You declared the base of the table width to 100% in the <table> tag.
So by declaring the #1 cell also to 100%, cell #2 has nothing to use.
That could be what's driving the spacer height up to 18 pixels.
It has nowhere to go.
As a test, change the cell#1 width to 50% and see what happens.



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET won't retrieve query results that depend on union query Eric Nelson ASP .Net 5 02-04-2009 10:51 PM
Trying to query the Address table data of AdventureWorks database from Query Analyzer - need help! Learner ASP .Net 1 01-30-2006 08:58 PM
Build dynamic sql query for JSTL <sql:query> Anonymous Java 0 10-13-2005 10:01 PM
xpath query query David Gordon XML 2 05-18-2005 03:33 PM
CAML Query: Multiple Query Fields Issue Jon F. ASP .Net Web Services 0 05-12-2004 08:19 PM



Advertisments