1

I am using the same style for my dropdown box, and a textbox, which is working fine, except that they are different lengths, only by ~10px

http://jsfiddle.net/PkWVg/

Wrong length

I can't seem to get them the same length without using seperate classes for each. It actually seems that the dropdown icon at the end is suppose to be to the right more?

CSS:

#container {
    width:500px;
}
.form-textbox, .form-dropdown {
    border: 0;
    outline: 0;
    height: 20px;
    width:100%;
    padding-left: 10px;
    background-color: rgb(204, 204, 204);
    color: #666;
}

HTML:

<div id="container">
    <select class="form-dropdown " name="turnover" />
    <option value="1">Less than £49,999 per year</option>
    <option value="2">£50,000 - £99,999 per year</option>
    <option value="3">£100,000 - £249,999 per year</option>
    <option value="4">£250,000 - £499,999 per year</option>
    <option value="5">£500,000 - £999,999 per year</option>
    <option value="6">£1,000,000 or more per year</option>
    </select>
    <br>
    <p>
        <input class="form-textbox ofTextbox" name="market" type="text" />
    </p>
</div>
1

3 Answers 3

2

Apply box-sizing

.form-textbox, .form-dropdown{
    border: 0;
    outline: 0;
    height: 20px;
    width:100%;
    padding-left: 10px;
    background-color: rgb(204, 204, 204);
    color: #666;
   -moz-box-sizing: border-box; // Added rule
   -webkit-box-sizing: border-box; // Added rule
    box-sizing:border-box; // Added rule
}

Fiddle

Sign up to request clarification or add additional context in comments.

3 Comments

I can see in my fiddle!
Appears that it depends on the browser. -moz-box-sizing:border-box; worked.
Yes For mozila it's -moz-box-sizing and for webkit browsers like safari and chrome it's -webkit-box-sizing :)
1

Add this:

-moz-box-sizing:border-box;
-webkit-box-sizing:border-box;
box-sizing:border-box;

Comments

0

The padding-left:10px appears to be the problem. If you remove that, the fields are the same length.

1 Comment

The padding is needed to position the text.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.