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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:58:03+00:00 2026-06-01T08:58:03+00:00

I am trying to achieve a layout where a sequence of divs are rendered

  • 0

I am trying to achieve a layout where a sequence of divs are rendered in one line with some of them left aligned and some of them right aligned.

<html>
    <body>
        <div width="100%">
            <div class="left">item1</div>
            <div class="left">item2</div>
            <div class="right">item3</div>
            <div class="right">item4</div>
        </div>
    </body>
</html>​
.left, .right
{
    display: inline-block;
    *display: inline;
    zoom: 1;
}
.right
{
    float: right;
}

​

I have above code, and it renders the way i expect in ie8, firefox, chrome. But on ie7 the right floated divs are shown in the next line instead of same line

non-ie7 result
ie7 result

I have a jsFiddle at http://jsfiddle.net/acdara/MEDSy/27/

I know the other solution is to float the left aligned elements as well, but i really want to keep the benefits of inline-block like not having to worry about the elements out of the flow.

I want to know if there is something else I can do for ie7 to keep the inline-block goodness.

  • 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-06-01T08:58:05+00:00Added an answer on June 1, 2026 at 8:58 am

    One solution is to flip the order of your markup so you’re floating the right elements first:

    <div class="right">item3</div>
    <div class="right">item4</div>
    <div class="left">item1</div>
    <div class="left">item2</div>
    

    The reason it wasn’t working on IE7 is because inline-block doesn’t work on IE7 for items that aren’t inline by default (see the browser compatibility chart for inline-block) so your floating will exhibit the normal behavior for floats for block items – i.e. if items are floated left first, the right floated items will fall below them in the same way block items in sequence would without floats.

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

Sidebar

Related Questions

The layout I'm trying to achieve is shown in this image: The HTML below
I'm trying to achieve a layout in html that looks exactly like this when
I have been trying to achieve a two-column layout with CSS where the left
I'm basically trying to achieve the following scrollable layout and am looking for some
What I want to achieve I'm trying to make a layout equal to the
Trying to achieve any moving effect while appending an element from one to another
I'm trying to achieve this layout with CSS (without tables, I guess. Whatever). Any
I'm trying to achieve the following layout without tables or JavaScript. It's basically the
I'm trying to achieve a simple layout of 4 horizontal inline-blocks within a container.
I'm trying achieve a way to display my images in a particular layout using

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.