简体   繁体   中英

HTML Buttons Vertical Alignment

I'm trying to set the CSS for displaying links as buttons.

The issue I am having is whenever the buttons require multiple lines of text, the other buttons on the same line are lowered slightly.

Code below;

<html>
  <head>
    <style>
      .pagebutton {
        background-color: #0039a6;
        color: white;
        text-align: center;
        text-decoration: none;
        display: inline-block;
        font-size: 20px;
        cursor: pointer;
        border: 10px solid #0039a6;
        border-radius: 16px;
        margin:5px;
        padding:10px;
        width: 200px;
        height: 50px;
    </style>
  </head>
  <body>
    <a href="https://www.google.com.au" class="pagebutton">Corporate Image Library</a>
    <a href="https://www.google.com.au" class="pagebutton">Employee Assistance Program</a>
    <a href="https://www.google.com.au" class="pagebutton">Employee Benefits</a>
    <a href="https://www.google.com.au" class="pagebutton">Health Site</a>
    <a href="https://www.google.com.au" class="pagebutton">News & Announcments</a>
    <a href="https://www.google.com.au" class="pagebutton">Social Club Site</a>
    <a href="https://www.google.com.au" class="pagebutton">Better Way Suggestions</a>
    <a href="https://www.google.com.au" class="pagebutton">Phone Contact List</a>
    <a href="https://www.google.com.au" class="pagebutton">Public Website</a>
    <a href="https://www.google.com.au" class="pagebutton">Contact Template Procedure Decision Tree</a>
    <a href="https://www.google.com.au" class="pagebutton">Whistleblower Integrity Hotline</a>
  </body>
</html>

Set the vertical-align property to top . The initial value of this is causing multi-line inline blocks to not render on the same line.

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