简体   繁体   中英

Add space between the two icons for all resolutions

I have one static row with two icons ion-email and ion-compose .

In my demo there is no space between the icons. I need to add some but it must work for all resolutions.

<div class="list">

  <a class="item item-icon-right" href="#">
    <i class="icon ion-email"></i>
    <i class="icon ion-compose"></i>
    Check mail
  </a>
      </div>

I need to add constant space between the two icons.

Here is my code: http://codepen.io/anon/pen/aOzOWZ

You need to acheive these changes - codepen

.item-icon-right i.icon {
  display: inline-block;
  float: right;
  position: relative;
  right: auto;
}

This will result in the following css, notice the commented out parts:

.item-icon-right .icon {
  /* right: 11px; */
  display: inline-block;
  float: right;
}
.item-icon-left .icon, .item-icon-right .icon {
  display: -webkit-box;
  display: -webkit-flex;
  display: -moz-box;
  display: -moz-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -ms-flex-align: center;
  -webkit-align-items: center;
  -moz-align-items: center;
  align-items: center;
  /* position: absolute; */
  /* top: 0; */
  height: 100%;
  font-size: 32px;
}

A very simple solution would be to statically position the first icon.

Simply add this class to your CSS.

.item-icon-right i:nth-child(1) {
  right: 50px;
}

For a more robust solution, I would suggesting creating styles for a separate component that can be floated to the right and will contain inline icons.

.icon-holder-right {
  float: right;
}

For example: http://codepen.io/anon/pen/MwYwqw

The benefit of this approach is that you won't overwrite any existing rules, meaning it's not likely to break any other parts of your app.

Try this

 .icon{ position:inherit !important; display:inline-block !important; float:right; } 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM