SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Zealot
    Join Date
    Feb 2002
    Location
    UK
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Text box length problem

    Hello again...
    Iíve got a problem setting the length of a text box. (see code below). Iím using size="3" (which is what I want) in the <input type of the code for setting the length. This looks fine in Dreamweaver 4 i.e. the length of the text box is 3 but when previewing in my browser it grows to about length 6 !!
    From the code youíll see that Iíve set font type using using css which works fine but canít control the length of this box.
    Any ideas out there
    sanc

    The code simplified:

    <STYLE TYPE="text/css">
    <!--
    td { font-size: 13px; }
    .formstyle {font-family: Arial, Helvetica, sans-serif;}
    -->
    </STYLE>
    </head>

    <body bgcolor="#FFFFFF" text="#000000">
    <input type="text" name="textfield" value="" size="3" maxlength="3" class="formstyle">
    </body>

  2. #2
    SitePoint Addict Caterwomtious's Avatar
    Join Date
    Dec 2001
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can set the width property using CSS, like this:

    .formstyle {font-family: Arial, Helvetica, sans-serif; width:20px;}

    It won't work in Netscape 4 but then, what does?

  3. #3
    SitePoint Zealot
    Join Date
    Feb 2002
    Location
    UK
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile

    Thanks Rick, works a treat.
    So thats the text box set to i.e.20px. How could I make another =40px on the same page?
    sanc

  4. #4
    SitePoint Wizard Aes's Avatar
    Join Date
    Jun 2001
    Location
    Oklahoma
    Posts
    3,392
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You are able to implement the styles directly into the individual input areas like so:
    Code:
    <input type="text" name="name" style="font-family : verdana ; width : 40px ; color : #000000 ;" />
    Otherwise you may simply create another class and utlilize that as well.

    -Colin
    Colin Anderson
    Ambition is a poor excuse for those without
    sense enough to be lazy.

  5. #5
    Posts rarely lloydi's Avatar
    Join Date
    Jan 2002
    Location
    Swindon UK
    Posts
    620
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    THis may be related, but I had huge problems before now when styling form elements. Often, sizes would increase dramatically when view in NN4, until I discovered:

    font-family:monospace;

    This solved all my woes

    [although the typeface isn't as attractive, but you can't have it all]
    Build Your Own Web Site the Right Way!
    A beginners' HTML/CSS book with web standards at its heart
    The Ultimate HTML Reference
    A complete reference, in glorious hardback


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •