Jump to content

Aligning Label To Top-left Of <textarea>


bigsilk

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.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...