Solved

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

Posted on 2013-06-10
4
407 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
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…
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 …

772 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

12 Experts available now in Live!

Get 1:1 Help Now