Link to home
Start Free TrialLog in
Avatar of Alicia St Rose
Alicia St RoseFlag for United States of America

asked on

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

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!
Avatar of Ishaan Rawat
Ishaan Rawat
Flag of India image

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...
Avatar of Tom Beck
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

ASKER CERTIFIED SOLUTION
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Alicia St Rose

ASKER

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!