Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

How to get text to go to top

I have an HTML input field whose height I extended to be complimentary to the page, but when typing, the text still appears in the center of the box rather than at the top of its enlarged state. I want to know how I can get it to the top, like it is in the box this question was written in, or in the answer box below.

2 Answers

This is the piece of code, I think it will help

#rant-input {
   float: left;
   height: 150px;
   width: 1350px;
   border-radius: 5px;
}
<input type = text id = rant-input>
Steven Parker
Steven Parker
215,940 Points

As the MDN documentation page says: "<input> elements of type text create basic, single-line inputs."

For multi-line input the <textarea> element would be a better choice, and the input in it aligns to the top by default:

<textarea id="rant-input"></textarea>

Youve saved me yet again Steven, thanks.