Home All Groups Group Topic Archive Search About

XHTML 1.1 and DIV 1 pixel in height

Author
17 Jan 2006 6:57 PM
e_zverev
The general question is: "Is it possible to achieve a DIV that is 1 pixel in
height?"
Keep in mind that I have to use XHTML 1.1 DOCTYPE.

All I did in HTML 4 to make this does not help. I.e. even if I set the
font-size to 1px and declare a style attribute height:1px my div is 2 pixels
tall.

Up to now I managed to get a table cell (TD) 1 pixel in height. But TD is
not convenient in my case.

Thanks for any suggestions in advance.
--
Eugene U. Zverev,
Senior Programmer

P.S. no thanks for ones like "try to use an image".

Author
17 Jan 2006 9:30 PM
clintonG
Well there must be somehow, this dude has sold pixels at $1.00 each to raise
funds he claims are for school but once the story hit "the news" I can't
load his page...

http://www.google.com/search?q=www.milliondollarhomepage.com


<%= Clinton Gallagher
         METROmilwaukee (sm) "A Regional Information Service"
         NET csgallagher AT metromilwaukee.com
         URL http://metromilwaukee.com/
         URL http://clintongallagher.metromilwaukee.com/




Show quoteHide quote
"e_zverev" <ezve***@discussions.microsoft.com> wrote in message
news:4073119E-4FD9-414C-A7D7-80AD8EC7DAA0@microsoft.com...
> The general question is: "Is it possible to achieve a DIV that is 1 pixel
> in
> height?"
> Keep in mind that I have to use XHTML 1.1 DOCTYPE.
>
> All I did in HTML 4 to make this does not help. I.e. even if I set the
> font-size to 1px and declare a style attribute height:1px my div is 2
> pixels
> tall.
>
> Up to now I managed to get a table cell (TD) 1 pixel in height. But TD is
> not convenient in my case.
>
> Thanks for any suggestions in advance.
> --
> Eugene U. Zverev,
> Senior Programmer
>
> P.S. no thanks for ones like "try to use an image".
Author
18 Jan 2006 10:30 AM
e_zverev
Hi

...hey, did only I hear someone cry: "let's stay productive!"?
I have got tons of ideas but no solution.

--
Eugene U. Zverev,
Senior Programmer
Author
19 Jan 2006 1:26 PM
Alessandro Riolo
e_zverev wrote:
> The general question is: "Is it possible to achieve a DIV that is 1 pixel in
> height?"
> Keep in mind that I have to use XHTML 1.1 DOCTYPE.

What about the very old approach to use a transparent gif (png if you
prefere) 1 px tall and large? Is that stretching to 2px as well? I have
not the time to test it, but I wouldn't believe that ;-)
HTH,

Author
20 Jan 2006 3:09 PM
e_zverev
Hi man

Didn't I ask not to suggest to use images?
As I said, the easiest way I found is the table with 1 pixel height cells
(TDs). I need a simplier solution, not more complex one.

.....aaarrggggghh.
Author
23 Jan 2006 6:37 PM
alessandro.riolo
e_zverev wrote:
> Didn't I ask not to suggest to use images?

You didn't mention such a constraint before ;-)

> As I said, the easiest way I found is the table with 1 pixel height cells
> (TDs). I need a simplier solution, not more complex one.

What's complex on using a transparent gif? Now, if I would have
suggested you to write your own browser, that would have been complex!
:-)

Apart the joke, why you don't get a DIV with an height 1px? Could you
please post an example code? Did you set the border?

Author
24 Jan 2006 4:20 PM
e_zverev
> You didn't mention such a constraint before ;-)
It was in P.S. in the original question: "P.S. no thanks for ones like "try
to use an image"."

Here is the code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html runat="server" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Untitled Page</title>
</head>
<body>
    <div style="width:100px; height:1px; background-color:Red;
font-size:1px"></div>
</body>
</html>


--
Eugene U. Zverev,
Senior Programmer
Author
24 Jan 2006 5:45 PM
addup
and the problem is?

It renders fine on firefox (1.5)

IE (6 on XP) seems to render it two pixels tall --- is this your issue?

try
<div style="overflow:hidden; width:100px; height:1px;
background-color:Red; "></div>
instead

hope this helps
-- addup --
Author
26 Jan 2006 8:58 AM
e_zverev
Hi

Yes, the problem was that it was 2 pixels tall. You solved it.
Overflow:hidden is the thing. Thanks!

--
Eugene U. Zverev,
Senior Programmer
Author
30 Jan 2006 5:21 PM
Alessandro Riolo
e_zverev wrote:
> It was in P.S. in the original question: "P.S. no thanks for ones like "try
> to use an image"."

A P.S. in the (and at the end of) signature is not exactly a place where
someone would probably look for constraints, anyway ;-)

Author
31 Jan 2006 1:21 PM
e_zverev
You are probably right :)
--
Eugene U. Zverev,
Senior Programmer