javascript – Why is span aligned differently inside button and anchor tag?


I want to show Message and Call buttons side by side. Call button is an anchor tag. I want the text to be vertically aligned in the middle for both of them:

.btn {
  min-height: 100px;
}
<!DOCTYPE html>
<head>
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha256-eZrrJcwDc/3uDhsdt61sL2oOBY362qM3lon1gyExkL0=" crossorigin="anonymous" />
</head>
<body>
  <div class="container">
    <div class="form-row">
      <div class="form-group col-6">
        <button class="btn btn-primary w-100">
          <i class="fa fa-envelope-o"></i>
          <span>Message</span>
        </button>
      </div>
      <div class="form-group col-6">
        <a href="tel:123456789" class="btn btn-secondary w-100">
          <i class="fa fa-phone"></i>
          <span>Call</span>
        </a>
      </div>
    </div>
</body>
</html>

Why is text aligned on the top for anchor tag? and how can I fix it?


Note: I just asked this question, and someone closed it immediately, saying it is a duplicate of this question… which contains neither any buttons nor any anchor tags. To the person who closed my question: Please take the time to read the question title before rushing to close them.



Source link

Latest articles

Related articles

Leave a reply

Please enter your comment!
Please enter your name here