10

The following css:

#contactform {
    width: 400px;
    height: 215px;
}

.webform {
}

.webform input .name {
    width: 50px;
}

.webform input .email {
    width: 70px;
}

.webform input .comments {
    width: 200px;
}

when used in html as

    <div id="contactform">
        <div class="webform">
            <input class="name" name="Name" type="text" id="senderName" placeholder="Enter your name here">
            <input class="email" name="Email" type="text" id="senderEmail" placeholder="Enter a valid email adress here">
            <br>
            <input class="comments" name="Comments" type="text" id="senderComments" placeholder="Comments...">
        </div>
    </div>

produces all three input field of the same width (50px = that is, the width of the webform input). I'm not sure what I'm doing wrong. Help?

2 Answers 2

9

your classes are on your inputs, not on child elements of the inputs. so change input .name, etc., to input.name or just .name, repeat for all three. :)

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

1 Comment

Thank you for the succinct explanation!
5

remove the whitespace between your input and class name

.webform input.name {
    width: 50px;
}

.webform input.email {
    width: 70px;
}

.webform input.comments {
    width: 200px;
}

Try this fiddle

2 Comments

Thank you... when you know something, it doesn't take long!
@UmeshA Thanks for the fiddle link.

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.