I’d like to normalize some elements in my page, like put some margin/padding on the submit button.
Tried with input.submit {margin:0; padding:1px 6px 1px 6px;} but seems that it doesnt work. How can I do this using CSS 2.1?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Most reliably with CSS 2.1 I think you’ve got the option of applying a
classoridto the button, or isolating the button inside of a particular parent element.Otherwise CSS 2.1 does support the attribute=value selector notation, so:
Should work. This is, however, variably reliable in Internet Explorer (although, to my surprise) is, according to PPK, of Quirksmode, available in IE>=7.
Edited to further explore the question:
The reason that
input.submit {margin:0; padding:1px 6px 1px 6px;}“doesn’t work” is because that selector,input.submitwould selectinputelements with a class-name ofsubmit. Unless you gave the submit button that class-name there’s no matching element in your html.With jQuery there’s the possibility to match submit elements with the selector
$('input:submit'), but that’s not a valid CSS-selector (so far as I’m currently aware); the nearest thing that CSS can offer is, as noted above, theinput[type=submit].Further reference: CSS2 [attr] selector, at Quirksmode.org.