Solved

Can't increase the max-length for a text input

Posted on 2013-06-10
4
413 Views
Last Modified: 2013-07-08
Hi,
I'm trying to give each input field a max length I've been able to do so with the first 3 fields but the field "Your Subject" won't change no matter what max-length I give it.

A visual will help:

http://sandbox.intrepidrealist.com/aya-papaya/contact/

Anyone see what I'm missing?

Thanks!
0
Comment
Question by:Alicia St Rose
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Ishaan Rawat
ID: 39236679
what are you talking about...
WHich browser are you using...

Can you please provide a screenshot of your issue....

because in chrome, its length is same as all others...
0
 
LVL 38

Expert Comment

by:Tom Beck
ID: 39237549
I'm guessing you are looking at this in Firefox because in Firefox the first three inputs line up with the right edge but the fourth does not. In Chrome all the inputs are the same length and none line up with right. Your method will not produce consistant cross browser results.

You are using max-width instead of width for the inputs. If you used width instead you could fiddle with each width until they all extend to the right edge. Don't do it though because there's no way to insure consistant display across all browsers. Inputs may jump to the next line in certain browsers.

One easy way to get all inputs to fill the remaining space after the label is to use a table with a 100% width.

Here's an example:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<style type="text/css">
.inputDiv input { width:100%; border:none; border-bottom:1px solid #000 }
</style>
</head>

<body>
<div style="width:500px">

<div class="email-address inputDiv">
	<table cellpadding="0" cellspacing="0" style="width:100%">
    <tr>
	<td><label>Your Email (required):</label></td>
    <td><span class="wpcf7-form-control-wrap your-email">
    	<input type="email" name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" />
    </span></td>
    </tr>
    </table> 
</div>

<div class="form-subject inputDiv">
	<table cellpadding="0" cellspacing="0" style="width:100%">
    <tr>
	<td><label>Subject:</label></td>
    <td><span class="wpcf7-form-control-wrap your-subject">
    	<input type="text" name="your-subject" value="" size="40" class="wpcf7-form-control wpcf7-text" />
    </span> </td>
    </tr>
    </table>
</div>
    
</div>
</body>
</html>

Open in new window

0
 
LVL 38

Accepted Solution

by:
Tom Beck earned 400 total points
ID: 39237680
Or this. Essentially the same with the same results.
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<style type="text/css">
.inputDiv { display:table; width:100% }
.inputDiv label { display:table-cell }
.inputDiv span { display:table-cell }
.inputDiv input { width:100%; border:none; border-bottom:1px solid #000 }
</style>
</head>

<body>
<div style="width:500px">

<div class="email-address inputDiv">
	<label>Your Email (required):</label>
	<span class="wpcf7-form-control-wrap your-email">
    	<input type="email" name="your-email" value="" size="40" class="wpcf7-form-control wpcf7-text wpcf7-email wpcf7-validates-as-required wpcf7-validates-as-email" aria-required="true" />
    </span>
</div>

<div class="form-subject inputDiv">	
    <label>Subject:</label></td>
    <span class="wpcf7-form-control-wrap your-subject">
    	<input type="text" name="your-subject" value="" size="40" class="wpcf7-form-control wpcf7-text" />
    </span>
</div>
    
</div>
</body>
</html>

Open in new window

0
 
LVL 7

Author Closing Comment

by:Alicia St Rose
ID: 39309147
This seemed like the best solution...if I were going to do this. I'm taking your advice and doing it a different way. I was looking in Firefox only. Sorry I wasn't as specific as I could have been.

Thanks for the help!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
This article discusses how to create an extensible mechanism for linked drop downs.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

943 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

4 Experts available now in Live!

Get 1:1 Help Now