I have the following:
form {
border: 1px solid #666;
}
<form action="#" method="post">
<p>
<label> Your name<br>
<span>
<input name="your-name" value="" size="40" type="text">
</span>
</label>
</p>
<p>
<label> Your telephone<br>
<span>
<input name="your-tel" value="" size="40" type="tel">
</span>
</label>
</p>
<p>
<label> Your email<br>
<span>
<input name="your-email" value="" size="40" type="email">
</span>
</label>
</p>
<p>
<label> Subject<br>
<span>
<input name="your-subject" value="" size="40" type="text">
</span>
</label>
</p>
<p>
<label> Attachments<br>
<span>
<input name="your-file" size="40" type="file">
</span>
</label>
</p>
<p>
<label> Your message<br>
<span>
<textarea name="your-message" cols="40" rows="10" ></textarea>
</span>
</label>
</p>
<p>
<input value="Send" type="submit">
</p>
</form>
The CSS is just to help visualizing the error, which is: on small screens (320x480) the <input>
s stretch beyond the form boundaries. Considering that I can't change the HTML, how can I prevent this?
For instance, I tried inserting "max-width: inherit" in each <label>
, <span>
and <input>
, and then setting the <p>
max-width
to 200px, which worked like a charm, but obviously would impact the layout on larger screens. I then tried changing this max-width
to 100%, but it just became the same as before.