开发者

Align text with right edge of an html form

I have an html form where the width of a textarea is specified with cols=. I want the textarea to have a specific width in terms of number of characters.

However, I also want some controls to be right-justified to the right edge of the textarea. They're not in the textarea, but directly above or below it. Is it possible to do this?

I was thinking a possible approach might be enclosing the textarea with some type of container that could grow to the width of the textarea, 开发者_C百科but I'm not sure how I could right-justify text within that.


Like this:

.Container {
  position: relative;
  float:left;
}
.Inner {
  position: absolute;
  right: 0;
}  

<div class="Container">
  <textarea cols="50"></textarea>
  <div class="Inner">Right edge!</div>
</div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜