Solved

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

Posted on 2013-06-10
4
418 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 10

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

770 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