Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2013-06-10
4
Medium Priority
?
438 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1600 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 8

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

719 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