Jump to content

Aligning Label To Top-left Of <textarea>


bigsilk
 Share

Recommended Posts

Notice how the labels for the <textarea> are located at the bottom-left of the boxes. I want them to be top-left.
I don't see any labels there, just some text inside of a DIV. As such, you can't do very much with CSS. What you need to do is actually wrap a <label> tag around each text and input pair. Then you can position things with CSS.It's always a good idea to surround text with some kind of tag to give it semantic meaning, and it also helps you position/style/manipulate that text with CSS. Without an enclosing tag it's hard to "reach" with CSS. The <div> tag is generic, it doesn't have any semantic meaning (which is why it's used to enclose other elements). You have to think of HTML like authoring any other kind of document, it's not just jumping through a bunch of hoops to get things to "look" right. If your document makes semantic sense it's usually much easier to work on the aesthetic side of things. Edited by sempervirent
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...