【问题标题】:how to bring ion icon in a input box with fixed position如何将离子图标带入固定位置的输入框中
【发布时间】:2019-11-06 02:18:21
【问题描述】:

如何将离子图标置于标签浮动的输入框右侧的固定位置。我只希望标签浮动而不是图标图标应该处于固定位置。我试图将位置设为固定,但它也是不工作。

<div class="input">
 <input type="date" [(ngModel)]="date" id="inputdate" required>
 <label>Date<ion-icon name="calendar" item-right> 
 </ion-icon>
 </label>
</div> 
$padding_input: .25em;
  $width_input_border: 1px;
  $color_form_bg: #E8F0F6;
  $time_animate: .25s;
  $color_valid: #344955;

  .input {
    margin-top: 33px;
    margin-left: 15px;
    position: relative;
    font-size: 1.2em;
    margin-bottom: .75em;
    color: #E8F0F6;
  }
label {
    font-size:19px;
    position: absolute;
    top: 50%;
    left: $padding_input;
    margin-left: $width_input_border;
    margin-top: -.6em;

    color: #344955;
    cursor: text; // keep it consistent

    transition: font-size $time_animate, 
      top $time_animate,
      left $time_animate,
      color $time_animate;
  }

  input {
    width: 95%;
    height: 50px;
    padding: $padding_input;
    border: 3px solid #344955;

    &:focus {
      & + label {
        color: #344955;
      }
    }

    &:valid {
      border-color: $color_valid;

      & + label {
        color: $color_valid;
      }
    }
  }

我想要一个浮动输入框,例如带有浮动名称的 gmail 登录。

【问题讨论】:

    标签: ionic-framework sass


    【解决方案1】:

    如果你想要输入浮点数,只需更改

    position:fixed;
    

    到与之相关的css类,并设置

    right:#px;
    bottom:#px;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-04
      • 2021-11-17
      • 2020-10-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多