亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在一個框中制作div并排用于貨幣輸入

如何在一個框中制作div并排用于貨幣輸入

慕絲7291255 2023-11-13 15:01:11
如何制作上面那樣的盒子?在沒有 boostrap 的純 css 中為什么我問這個是因為我不使用 bootstrap 4 并且找不到任何方法將它與 boostrap 3 一起使用,我試圖制作一個,但它的盒子變得像一列向下這是我的CSS:.currency {  white-space: nowrap;  max-width: 150px;  overflow: hidden;  text-overflow: ellipsis;  float:left;  border: 2px solid;}和我的html<div>  <label class="currency"></label>  <input type="text"> 1000</div>
查看完整描述

2 回答

?
明月笑刀無情

TA貢獻1828條經驗 獲得超4個贊

包裝器可以是一個label元素,貨幣符號可以是::before偽元素,它可以讀取data-*標簽本身的屬性。


label {

   border: 2px #ccc solid;

   border-radius: .5em;

   display: inline-flex;

   color: #666;

   overflow: hidden;

   font: 2rem Verdana;

}


label:before {

   content: attr(data-currency);

   width: 2.5em;

   padding: .5em 0;

   background: #e6e6e8;

   text-align: center;

   font: inherit;

   border-right: inherit;

}


input {

   border: 0;

   padding: .25em .75em;

   font: inherit;

   color: inherit;

}

<label aria-label="Enter the amount in €" data-currency="€">

   <input type="text" />

</label>


查看完整回答
反對 回復 2023-11-13
?
眼眸繁星

TA貢獻1873條經驗 獲得超9個贊

<div class="input-group">

  <span class="input-group-addon" id="basic-addon1">@</span>

  <input type="text" class="form-control" placeholder="Username" aria-describedby="basic-addon1">

</div>

這段代碼使用 bootstrap 3 所以如果你愿意的話可以嘗試一下


查看完整回答
反對 回復 2023-11-13
  • 2 回答
  • 0 關注
  • 176 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號