Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7059169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:12:00+00:00 2026-05-28T04:12:00+00:00

I have two button bars- each contains links, but one also contains a submit

  • 0

I have two button bars- each contains links, but one also contains a submit button of a certain height. The one with the submit button has all the elements vertically centered. I want the other button bar, without the submit button, to look the same, so I gave it an explicit height. However, the links within it align to the top instead of in the middle.

What’s going on here, and how can I make link bars that are of a consistent height, with vertically centered elements?

HTML:

<div class="link-bar">
    <input type="submit" value="Save"/>
    <a href="#">link</a>
    <a href="#">link</a>
</div>

<div class="link-bar">
    <a href="#">link</a>
    <a href="#">link</a>
</div>

CSS:

input[type='submit'] {
    width:100px;
    height:40px;
    border:solid red 1px;
}
.link-bar {
    height:40px;
    background:#EEE;
    border:blue 1px solid;
    margin:10px;
    vertical-align: middle;
}

See jsFiddle for example

enter image description here

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:12:00+00:00Added an answer on May 28, 2026 at 4:12 am

    Simply add line-height equal to the height. By default, any text on that line will be vertically centered. The exception occurs if you wrap the text to a new line.

    http://www.w3.org/wiki/CSS/Properties/line-height

    I also removed your vertical-align as it’s superfluous to content in block level elements. It only applies to inline elements.

    .link-bar {
        height: 40px;
        background: #EEE;
        border:blue 1px solid;
        margin: 10px;
    }
    
    .link-bar a {
        line-height: 40px; /* equal to the height of the container */
    }
    

    DEMO:

    http://jsfiddle.net/SLqbk/9/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two button each with a Context Menu, but I'm unsure how to
I have two forms, one with a radio button that users must select to
I have two buttons with the same ID: <button type=submit onclick=//do something id=theID>button 1</button>
I have two fields which calculate a total, but I have a radio button
I have two EditText and one Button in my Layout. If the two EditText
I have two divs as follows: <div class=car-service id=browse-all-button> <p>CAR SERVICE</p> <span>56 Race Ramps</span>
I have two <button> elements in one form. First <button> have a click handler,
I have two buttons on my application. One button starts a new Game (lets
I have two forms. One is a parent form with a button and a
I have two classes like firstactivity.java and secondactivity.java. In firstactivity I have a button(submit)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.