470,831 Members | 1,663 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,831 developers. It's quick & easy.

Minimum width for <input> etc?

How can i set in my css a min width for input elements, but leave the max
size dynamic?

Ben
Jul 20 '05 #1
3 11929
In article <3f***********************@freenews.iinet.net.au >, iinet
wrote:
How can i set in my css a min width for input elements, but leave the max
size dynamic?


for example:

input {min-width:40em;}

Won't work on IE. I don't think there is any way to make it work in IE.

I don't think this is best possible answer to your question, URL would
help.

--
Lauri Raittila <http://www.iki.fi/lr> <http://www.iki.fi/zwak/fonts>
Feel free to contact me by email if your message OT, or private, etc.
but do not CC same message to as you send to usenet.
Jul 20 '05 #2
Lauri Raittila <la***@raittila.cjb.net> writes:
In article <3f***********************@freenews.iinet.net.au >, iinet
How can i set in my css a min width for input elements, but leave the max
size dynamic?


for example:

input {min-width:40em;}

Won't work on IE. I don't think there is any way to make it work in IE.

I don't think this is best possible answer to your question, URL would
help.


According to the specification, min-width doesn't apply to
non-replaced inline elements such as <input>, so you'd also need to do
a display: block; or similar.

And browsers tend to accept a lot less styling on form input elements
than they do on others, so I'm not sure if this is reliably possible
at all.

Pity, because it could be quite useful for a user stylesheet. As
regards author stylesheet it seems better to set the width
appropriately through the HTML.

--
Chris
Jul 20 '05 #3
Chris Morris <c.********@durham.ac.uk> wrote:
According to the specification, min-width doesn't apply to
non-replaced inline elements such as <input>, so you'd also need to
do a display: block; or similar.
The concepts of "replaced" or "non-replaced" element are confusingly
and vaguely defined, but the CSS2 specification explicitly mentions
INPUT as _replaced_ element. Well, in its vague style:
"In HTML, IMG, INPUT, TEXTAREA, SELECT, and OBJECT elements can be
examples of replaced elements."
http://www.w3.org/TR/REC-CSS2/confor...placed-element
And browsers tend to accept a lot less styling on form input
elements than they do on others,
Indeed, but the situation is improving.
so I'm not sure if this is reliably possible at all.
Surely not reliably - CSS is unreliable _by design_ (in the sense that
a style sheet might not be applied, or might be applied in conjunction
with other style sheets that override it, in part or entirely).
Pity, because it could be quite useful for a user stylesheet.


Seems to work on Opera, for example. But there are other potential
problems with input fields that might more serious. Authors often set
font size in input fields to something very small, for example.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Jonathan Daggar | last post: by
2 posts views Thread by not 2 swift | last post: by
2 posts views Thread by Richard Maher | last post: by
1 post views Thread by test9991014 | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.