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

  • Home
  • SEARCH
  • 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 8025645
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T23:13:50+00:00 2026-06-04T23:13:50+00:00

I have some HTML that a 3rd party API builds, so I have no

  • 0

I have some HTML that a 3rd party API builds, so I have no control of the output. The only thing I can change is the CSS. I would prefer not to use JavaScript, if possible.

What I’m trying to do is swap 2 elements using float:left on the second, so it’s displayed before the first one. This works well on modern browsers, but causes the “swapped” element to move to the second line on older IE browsers (specifically 6 and 7, and IE in compatibility mode).

jsFiddle Example

HTML (cannot change)

<div class="wrapper">
    <a class="page">Page: &nbsp;</a>
    <a class="previous">Prev</a>
    <span>
        <a>1</a>
        <a>2</a>
    </span>
    <a class="next">Next</a>
</div>​

CSS

.wrapper{
    line-height:36px;
}
.wrapper span, .page{
    float:left;
}
.wrapper span a, .page{
    display:inline-block;
}
.wrapper span a{
    width:20px; 
}
.previous, .next{
    width:30px;
    display:inline-block;
}

Modern Browser Screenshot

Modern Browser Screenshot

Internet Explorer Screenshot

Internet Explorer Screenshot

  • 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-04T23:13:52+00:00Added an answer on June 4, 2026 at 11:13 pm

    The issue turned out to be a bug with how IE6 and IE7 (not present in IE8) handle float:right; within a left-aligned element. Instead of simply positioning the element on the closest point to the left, past any content (as modern browsers do), IE6 and IE7 position the element in the farthest right point possible (which, isn’t that much different in terms of definition, but makes a huge difference in cases like this).

    Anyway, to get past this limitation, float:right; could not be used as a solution. As there was no way of knowing (without JavaScript, which the OP stated should not be used) what the width of .content span was (variable number of pages), a static width could not be used on .wrapper. Instead, the “Next” and “Prev” link elements had to be “discarded” until the end, then positioned absolutely (relative to .wrapper) after the width of .wrapper had been figured out.

    jsFiddle Example

    The Magical CSS

    .wrapper {
        float:left; /* Can be 'display:inline;' instead, but this makes it possible to treat this as "block" */
        clear:left; /* Can be discarded if 'float:left;' isn't used */
        position:relative; /* Keeps 'next'/'prev' contained */
    }
    .page, span {
        float:left; /* Positions 'Page:' and page numbers on left */
    }
    .page, span a {
        padding-right:.5em; /* Can change this to whatever */
    }
    .previous {
        position:absolute;
        right:-6em; /* Width (including padding, borders, etc) of .previous and .next */
        width:2.5em;
        padding-right:.5em;
    }
    .next {
        position:absolute;
        right:-3em; /* Width (including padding, borders, etc) of .next */
        width:2.5em;
        padding-right:.5em;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a HTML/CSS snippet that is included in some 3-rd party website. But
I have some html that is created/output from a flash application & I need
I have some html that is output by PHP's urlencode - basically it's a
In my web app, the user can create some HTML/CSS markup that is saved
I have some HTML that I need to toggle between two structures - one
I have some HTML that looks like this: <div> <div class=value> <a href=# class=clicker>Some
I have some HTML that is stored as an attribute on a tag. I
I have some HTML that looks like this: <div class=product> Content In Here <div
If I have some HTML that looks like this: <div id=text> This is some
So I have some html that looks like the following: <div class='something unknown' id='something_unknown_1'>

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.