I came up with another way that works... but it requires an extra nested
div, which seems wrong to me:
<div style="width:15em;background-color: green;">
<div style="padding: 0 5px 0 0;">
<input type='text' style='width:100%'>
</div>
</div>
The 5px compensates for the border and padding used by FireFox when drawing
a text box (6px are used by IE). This method means the text boxes are the
correct size, although with IE, the nested div exteends to the right.
Piers
"Piers Lawson" <Piers@Lawson.n.a.m.e.NOSPAM> wrote in message
news:3yT_d.30305$3A6.21893@newsfe1-gui.ntli.net...[color=blue]
> You are right Jon, changing to
>
> <input type='text' style='display:block;width:auto;'>
>
> just means the text box returns to its natural size, which is less than[/color]
15em[color=blue]
> wide... so it isn't the answer. I thought about using:
>
> <input type='text' style='width:14.8em;border-width: 0.1em;padding:0'>
>
> But I guess the default font size for a text box is less than the[/color]
inherited[color=blue]
> size, so it doesn't work either! The following does work:
>
> <input type='text' style='width:14.5em;border-width:
> 0.25em;padding:0;font-size:1em'>
>
> but has two downsides, the width is hardcoded and the font size is no[/color]
longer[color=blue]
> "natural".
>
> Thank you for your ideas!
>
> Piers
>
> "Jón Fairbairn" <jon.fairbairn@cl.cam.ac.uk> wrote in message
> news:wfk6o56j38.fsf@calligramme.cl.cam.ac.uk...[color=green]
> > Lauri Raittila <lauri@raittila.cjb.net> writes:
> >[color=darkred]
> > > in comp.infosystems.
www.authoring.stylesheets, Jón
> > > Fairbairn wrote:
> > > > Indeed. But since he wants the border, what value should he
> > > > put in place of 100%? AFAIK there's no way to say
> > >
> > > auto
> > >
> > > > width: 100% - 0.2em; border-width: 0.1em
> > > >
> > > > to get it to add up right.
> > >
> > > border-width:0.1em should suffice, you can use width:auto; for block
> > > elements just fine.[/color]
> >
> > Really? If I change the OP's code to:
> >
> > <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
> > 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
> > <HTML xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
> > <HEAD>
> > </HEAD>
> > <BODY>
> > <DIV style="width:15em;background-color: green;">
> >
> > </DIV>
> > <DIV style="width:15em;background-color: red;padding: 0;">
> > <input type='text' style='display:block;width:auto'>
> > </DIV>
> > </BODY>
> > </HTML>
> >
> > both gecko and Opera display some red space to the right of
> > the input box.
> >
> >
> > --
> > Jón Fairbairn
Jon.Fairbairn@cl.cam.ac.uk
> >
http://www.chaos.org.uk/~jf/Stuff-I-dont-want.html (updated 2005-02-09)[/color]
>
>[/color]