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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:10:29+00:00 2026-05-30T13:10:29+00:00

I have a div (#wrapper) containing 2 divs standing side by side. I would

  • 0

I have a div (#wrapper) containing 2 divs standing side by side.

I would like the right-div to be vertically aligned. I tried vertical-align:middle on my main wrapper but it is not working. It is driving me crazy!

Hope someone can help.

http://cssdesk.com/LWFhW

HTML:

<div id="wrapper">
  <div id="left-div">
    <ul>
      <li>One</li>
      <li>Two</li>
    </ul>
  </div>  
  <div id="right-div">
    Here some text...
  </div>
</div>

CSS:

#wrapper{
  width:400px;
  float:left;
  height:auto;
  border:1px solid purple;}

#left-div{
  width:40px;
  border:1px solid blue;
  float:left;}

#right-div{
  width:350px;
  border:1px solid red;
  float:left;}

ul{
  list-style-type: none;
  padding:0;
  margin:0;}
  • 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-30T13:10:30+00:00Added an answer on May 30, 2026 at 1:10 pm

    You’ll have no luck with floated elements. They don’t obey vertical-align.

    You need display:inline-block instead.

    http://cssdesk.com/2VMg8


    Beware!

    Be careful with display: inline-block; as it interprets the white-space between the elements as real white-space. It does not ignores it like display: block does.

    I recommend this:

    Set the font-size of the containing element to 0 (zero) and reset the font-size to your needed value in the elements like so

    ul {
        margin: 0;
        padding: 0;
        list-style: none;
        font-size: 0;
    }
    ul > li {
        font-size: 12px;
    }
    

    See a demonstration here: http://codepen.io/HerrSerker/pen/mslay


    CSS

    #wrapper{
      width:400px;
      height:auto;
      border:1px solid green;
      vertical-align: middle;
      font-size: 0;
    }
    
    #left-div{
      width:40px;
      border:1px solid blue;
      display: inline-block;
      font-size: initial;
      /* IE 7 hack */
      *zoom:1;
      *display: inline;
      vertical-align: middle;
    }
    
    #right-div{
      width:336px;
      border:1px solid red;
      display: inline-block;  
      font-size: initial;
      /* IE 7 hack */
      *zoom:1;
      *display: inline;
      vertical-align: middle;
    }
      
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a wrapper containing several divs. I would like this wrapper to be
I have a div wrapped around an image, like this: <div class=containing-div> <div class=image-wrapper>
I have a wrapper div containing 10 thumbnail divs each of which contains 10
I have a div wrapper, and inside it, i want divs to be side
I have a header. Below that header I have a wrapper containing 2 divs
I have two divs inside a wrapper div of width 880px. The first div
I have a div element containing a few other divs with an id of
I have a div nested inside another <div id=wrapper> <div id=left></div> <div id=right></div> <div
I have a wrapper div with a height of 600px and a width of
I have a main wrapper div that is set 100% width. Inside that 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.