我想讓進度文本位於容器progressish
內,即使寬度爲例如100%。就像現在一樣,文本固定在容器的右側,如下面的第一張圖所示。防止文本走出容器,如果它的寬度超過90%
當進度條的寬度爲一個例子的40%,它看起來像這樣(如預期):
但當進步或者是90%或100%,我希望文字粘在最右邊的進度條的,像這樣的:
section#progressish {
width: 300px;
}
div#text {}
div#text>div {
margin-bottom: 5px;
margin-left: 100%;
min-width: 100px;
width: auto !important;
width: 100px;
}
div#progressbar {
background-color: #d1d1d1;
height: 10px;
margin-bottom: 15px;
width: 100%;
}
div#progressbar>.progress[data="bar"] {
background-color: #111111;
height: 10px;
margin-bottom: 15px;
width: 100%;
}
<section id="progressish">
<div id="text">
<div>100% avklarat</div>
</div>
<div id="progressbar">
<div class="progress" data="bar"></div>
</div>
</section>
我怎樣才能做到這一點?你可以在jsFiddle看到整個源代碼:https://jsfiddle.net/a7buqqkk/。
@Jer:我不想讓文字一直卡在正確的位置。請再次閱讀我的問題。 – Erik
對不起,不明白你的問題,好哈哈!忘記我的評論;) – Jer
@Erik,檢查我的答案! – Ehsan