Marc Rasmussen
Marc Rasmussen

Reputation: 20555

Align button with an icon that is with a bigger font

I have a list block where I have a "Get Data" button with an icon. Now I want to move this icon a bit down and make the font bigger however when I attempt to do this the list item is not aligned with the other items (it sets itself a bit lower than the other items)

What is the best way of doing this? I really want the items on the list to be text-aligned.

.item-card {
  display: block;
  box-shadow: rgba(0, 0, 0, 0.35) 0 5px 15px;
  cursor: pointer;
  font-family: Titillium Web, sans-serif;
  max-height: 70px;
}
.item-card:focus {
  border: #b20c1c solid;
}

.justified-list {
  padding: 5px;
  width: 100%;
  margin: 0;
}


button {
  background: none;
  color: inherit;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  outline: inherit;
}

button:hover:active:focus {
  background-color: white;
  color: #61070f;
}

.jl-item {
  padding: 20px;
  display: inline-block;
}
.jl-item:focus{
  border: #61070f solid;
}

.btn-hent-pass {
  color: #b20c1c;
  text-decoration: none;
}

.float {
  max-width: 1200px;
  margin: 0 auto;
}

.float:after {
  content: ".";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

.float-item {
  float: left;
}

.last{
  float: right;
}

.iconStyle{
font-size: 25px;
position: relative;
top: 3px;
}

@media only screen and (max-width: 320px) {
}

@media only screen and (min-width: 345px) {
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" rel="stylesheet"/>
<div class="item-card float">
  <ul class="justified-list">
    <li class="jl-item float-item" tabindex="0">16-06-2021</li>
    <li class="jl-item float-item" tabindex="0">Text</li>
    <li class="jl-item last float-item"><button class="btn-hent-pass" (click)="click.emit()" >Get Data <i class="fas fa-download iconStyle"> </i></button>
    </li>
  </ul>
</div>

<div class="item-card float">
  <ul class="justified-list">
    <li class="jl-item float-item" tabindex="0">16-06-2021</li>
    <li class="jl-item float-item" tabindex="0">Text</li>
    <li class="jl-item last float-item"><button class="btn-hent-pass" (click)="click.emit()" >Get Data <i class="fas fa-download iconStyle"> </i></button>
    </li>
  </ul>
</div>

Upvotes: 1

Views: 37

Answers (2)

itsankitbhusal
itsankitbhusal

Reputation: 481

.iconStyle{
font-size: 16px;
position: relative;
top: 3px;
}

simply remove the top: 3px; from the code and it will align.

Upvotes: 1

Karl
Karl

Reputation: 11

Try to increase the line height or make it match the img. Some fonts just sit lower than others...

Upvotes: 1

Related Questions