Solved

Text Box size

Posted on 2006-11-14
6
161 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
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

856 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