Solved

Text Box size

Posted on 2006-11-14
6
158 Views
Last Modified: 2010-04-09
In an HTML form when using input type="text", I want the size to be very small.

When I put size="1", it still allows 4 or 5 characters to be typed into the box.

Is there any way to make it smaller in width than size="1"?

I relaize that maxlength can limit the number of characters typed in. It's more the width on the form that is sometimes an issue.
0
Comment
Question by:Richard Korts
6 Comments
 
LVL 19

Expert Comment

by:VoteyDisciple
ID: 17943179
You're better off in this situation controlling the physical size of the box through your stylesheet.  A simple rule like:

input.whatever {
    width: 1em;
}

... (adjusting the width to something you like) is all you'd need.
0
 

Author Comment

by:Richard Korts
ID: 17943231
To VoteyDisciple,

Can you be more specific? I don't understand what you mean. I need to see both the stylesheet code AND the <input type....> code.

Please gove me a specific example.

Thanks

0
 
LVL 19

Expert Comment

by:VoteyDisciple
ID: 17943269
HTML:
<input type="text" name="whatever_name" class="whatever" />


CSS:
input.whatever {
    width: 1em;
}
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 4

Accepted Solution

by:
gcmachel earned 500 total points
ID: 17944275
You can use inline stylesheet like this,

<input type="text" name="whatever_name" class="whatever"  style="width: 1em;" />

Regards - G.
0
 
LVL 1

Expert Comment

by:kurnia
ID: 17946066
Use maxlength if you want to limit numbers of characters.

<input type="text" size="1" maxlength = "1" style="width: 1em;" />
0
 
LVL 3

Expert Comment

by:viveksg
ID: 17986314


<input type="text" name="txtTest" style="width: 1em;" />
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now