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 977007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:50:07+00:00 2026-05-16T03:50:07+00:00

I have a horizontal <ul> and I need to center each <li> in it

  • 0

I have a horizontal <ul> and I need to center each <li> in it vertically. My markup is below. Each <li> has a border, and I need the items as well as their contents to be in the middle vertically. Please help; I am new to CSS.


<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
        .toolbar li
        {
            border: solid 1px black;
            display: block;
            float: left;
            height: 100px;
            list-style-type: none;
            margin: 10px;
            vertical-align: middle;
        }
        .toolbar li.button
        {
            height: 50px;
        }
    </style>
</head>
<body>
    <div class="toolbar">
        <ul>
            <li><a href="#">first item<br />
                first item<br />
                first item</a></li>
            <li><a href="#">second item</a></li>
            <li><a href="#">last item</a></li>
            <li class="button"><a href="#">button<br />
                button</a></li>
        </ul>
    </div>
</body>
</html>
  • 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-16T03:50:07+00:00Added an answer on May 16, 2026 at 3:50 am

    I assume that since you’re using an XML declaration, you’re not worrying about IE or older browsers.

    So you can use display:table-cell and display:table-row like so:

    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
        <style type="text/css">
            .toolbar ul {
                display:table-row;
            }
            .toolbar ul li
            {
                display: table-cell;
                height: 100px;
                list-style-type: none;
                margin: 10px;
                vertical-align: middle;
            }
            .toolbar ul li a {
                display:table-cell;
                vertical-align: middle;
                height:100px;
                border: solid 1px black;
            }
            .toolbar ul li.button a {
                height:50px;
                border: solid 1px black;
            }
        </style>
    </head>
    <body>
        <div class="toolbar">
            <ul>
                <li><a href="#">first item<br />
                    first item<br />
                    first item</a></li>
                <li><a href="#">second item</a></li>
                <li><a href="#">last item</a></li>
                <li class="button"><a href="#">button<br />
                    button</a></li>
            </ul>
        </div>
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i need horizontal scrolling script in javascript, but don't have much time to write
I need to disable slickgrid horizontal scrollbar. I have only one column and have
Need some help, please. I have a line of horizontal thumbnails loaded as ONE
I have a horizontal unordered list I want to center horizontally in a div
If I have something like: <StackPanel Orientation=Horizontal> <TextBlock Text=FIRST Margin=5 VerticalAlignment=Center /> <TextBlock Text=SECOND
I have a layout which contains 4 horizontal LinearLayouts with 3 ImageButtons inside each
I have a horizontal navigation menu with 5 buttons and i need to change
I need to have a scroll view above a horizontal linear layout. My root
Do you know any controls inherited from the ItemsControl that have horizontal orientation of
I have a horizontal menu bar created using ULs and LIs. The issue I

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.