Forgive me for asking such a simple question, I’m new to both HTML and CSS.
Is there an easy way to center a textarea? I figured I’d just try using
textarea{
margin-left: auto;
margin-right: auto;
}
but it (obviously?) didn’t work.
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.
The margins won’t affect the textarea because it is not a block level element, but you can make it display block if you like:
By default, textareas are
display: inline, which is why you can put them side-by-side easily, and why thetext-align: centeranswers work too.The textarea can also be centered by putting it inside a flexbox container like this: