开发者

Align text with right edge of an html form

开发者 https://www.devze.com 2022-12-25 18:37 出处:网络
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.

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

精彩评论

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

关注公众号