のテキスト領域id="aboutme"
と のスパンがあり、スパンをテキスト領域class="maxlength-feedback"
の右上隅に配置したいと考えています。テキストエリアのカウンターになります。
両方の要素が必要position="relative"
であり、スパンが である必要があることはわかっていますがdisplay="inline-block"
、機能していません。
助けていただければ幸いです。ありがとう。
のテキスト領域id="aboutme"
と のスパンがあり、スパンをテキスト領域class="maxlength-feedback"
の右上隅に配置したいと考えています。テキストエリアのカウンターになります。
両方の要素が必要position="relative"
であり、スパンが である必要があることはわかっていますがdisplay="inline-block"
、機能していません。
助けていただければ幸いです。ありがとう。
このようにしてください
説明:textarea
コンテナー内をラップしてコンテナーdiv
に渡します。position: relative;
次に、divのデフォルトの動作を確認してposition: absolute;
、スパンが左端に流れるようにします。コンテナーdivに使用します。span
display: block;
display: inline-block;
HTML
<div class="wrap">
<textarea></textarea>
<span>Counter</span>
</div>
CSS
.wrap {
position: relative;
display: inline-block;
}
.wrap span {
position: absolute;
top: 0;
right: 0;
}
HTML
<div>
<span class="mySpan">Some Text</span>
<textarea class="myTextArea"></textarea>
</div>
CSS
div{
position: relative;
float:left;
}
.mySpan{
position: absolute;
right: 0px;
}
いいえ、maxlength-feedbackは次のようにabsolute
配置する必要があります。
#aboutme {
position:relative;
}
.maxlength-feedback {
position:absolute;
right: 0; /* or so */
top: 0; /* or so */
}