SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
Oct 24, 2007, 15:22 #1
- Join Date
- Dec 2004
- Location
- Bellevue, WA
- Posts
- 222
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Restricting width of input text boxes
I've searched the internet and these forums for my answer but can't seem to find one. Does anyone know...is it possible to restrict the size of your input type="text" boxes? I've used size="2" and maxlength="2" and it still won't get any smaller. I have 3 input type="text boxes side by side. The first one is for 2 digits and the next 2 are for 3 digits. But they all 3 look the same size. I've also tried using width:20px; and different pixel lengths to get it size down. But it just won't get any smaller. I want to make it clear to the users filling out my form that there are 2 digits in the first box and then 3 digits in the next 2. Is this possible to make those boxes smaller? I've also set the font-size to 11px.
-
Oct 24, 2007, 15:34 #2
- Join Date
- Aug 2007
- Location
- Brighton, UK
- Posts
- 2,006
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
style="width: [ENTER SIZE IN PIXELS]" ???
^^ Tried this ^^ ??
e.g.Code:<input style="width: 100px" type="text" name="textfield" id="textfield" />
★ James Padolsey
–––––––––––––––––––––––––––––––––––––––
Awesome JavaScript Zoomer (demo here)
'Ajaxy' - Ajax integration solution (demo here)
-
Oct 24, 2007, 15:53 #3
- Join Date
- Dec 2004
- Location
- Bellevue, WA
- Posts
- 222
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
hmmm i had tried this before but in my external stylesheet. for some reason it didn't work. but when i tried it again as an inline style, it now works. i must be missing something. anyways, thanks...i guess i'll just use an inline style for it for now.
thanks. hope it works in other browsers also. i've only viewed it in IE so far.
-
Oct 24, 2007, 16:08 #4
- Join Date
- Jul 2006
- Location
- Victoria, Australia
- Posts
- 4,122
- Mentioned
- 29 Post(s)
- Tagged
- 2 Thread(s)
That will work anywhere it doesn't have to be inline, oh and I hope you're not using id="textfield" for each input
-
Oct 24, 2007, 22:36 #5
- Join Date
- Nov 2004
- Location
- Ankh-Morpork
- Posts
- 12,158
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
-
Oct 24, 2007, 23:52 #6
- Join Date
- Jul 2006
- Location
- Victoria, Australia
- Posts
- 4,122
- Mentioned
- 29 Post(s)
- Tagged
- 2 Thread(s)
I've used pixels for the width of inputs before, I see you're point but I wouldn't want my layout breaking if the user changed their font-size
My choice would be dependant on the design - and not simply because it contains text.
-
Oct 25, 2007, 00:03 #7
- Join Date
- May 2006
- Location
- Aurora, Illinois
- Posts
- 15,476
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Because sometimes the design may require it. Thankfully those instances are few and far between, however.
Save the Internet - Use Opera | May my mother rest in peace: 1943-2009
Dan Schulz - Design Team Advisor | Follow me on Twitter
SitePoint References: HTML CSS JavaScript | Become A Guru
WordPress SEO Checklist | What WordPress Plugins Do You Use?
Web Standards Curriculum | Image Free Equal Height Columns
Bookmarks