XHTML 1.1 and DIV 1 pixel in height

E

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.
 
E

e_zverev

Hi

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

Alessandro Riolo

e_zverev said:
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,
 
E

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.
 
A

alessandro.riolo

e_zverev said:
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?
 
E

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top