Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML5 - text input with padding is too wide

Tags:

html

css

html4

I want an input field which will be padded from inside. I'm transferring to HTML5. I have it working in HTML 4.01 Transitional, but in HTML5 the input field started to go out of table frame. Can you help me correct it for HTML?

Part of HTML Code

<td class="content_listing_r" style="width: 80%;">
    <input type="text" name="model_search" style="width: 100%; padding: 5px"  autocomplete="off" />
</td>

It looks like this:

enter image description here

But should be looking like this:

enter image description here

Here's a fiddle for you to check out and play with it: http://jsfiddle.net/kelu/DbXy5/5/

like image 696
Kelu Thatsall Avatar asked Jan 07 '14 14:01

Kelu Thatsall


1 Answers

Add this CSS box-sizing rule to your input field:

.content_listing_r input {
    box-sizing:border-box;
    -moz-box-sizing:border-box;
}

jsFiddle example

like image 72
j08691 Avatar answered Sep 21 '22 19:09

j08691