Is this valid CSS to center the div and also apply a top margin?
div {
margin: 0 auto;
margin-top: 30px;
}
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.
Use the following to specify margins:
Which is shorthand for:
Which is shorthand for:
Now that you know the different ways
margins, and/orpadding, can be specified; the choice is yours.As far a precedence is concerned the later definition will apply; as defined in the spec.
As others have mentioned, you’ll likely need to specify a fixed width in order to see your
divcentered …