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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:27:33+00:00 2026-05-26T23:27:33+00:00

I have some html code that look like this sample here : <html> <body>

  • 0

I have some html code that look like this sample here :

<html>
  <body>
    <div id="A" style="float:right; Background-color: Red;">Alpha</div>
    <div id="B" style="margin-top: 20px; Background-color: Green;">Bravo</div>
  </body>
</html>

What I’d like to achieve is have the A div in the upper right corner and the B div aligned on the left 20 pixels from the top of the page. As you can see below, it does exactly what I want in IE8, but it doesn’t quite works in Chrome and Firefox.

enter image description here

Because it’s often the case, I suppose Chrome and FF are right to render it this way and IE8 is not following the standard. So my question is how can I get the desired result (What IE does in the SS) across all browser?

EDIT1&2: I edited the screenshot to show that I really want the Bravo div to be on the left of the Alpha div but 20px lower and not under it like it would if I simply add a clear: right on Bravo.

Thanks

  • 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-26T23:27:34+00:00Added an answer on May 26, 2026 at 11:27 pm

    EDIT
    Answer to the new question:

    <div id="A" style="float:right; background-color: Red; margin-top: -5px;">Alpha</div>
    <div id="B" style="margin-top: 20px; background-color: Green;">Bravo</div>
    

    ORIGINAL
    (The question author originally asked this and later changed the question…)

    Add clear: right; into B div’s style. Optionally use clear: both;. And wrap div A into a wrapper div like this:

    <div id="wrapper" style="overflow: hidden;">
        <div id="A" style="float:right; background-color: Red;">Alpha</div>
    </div>
    <div id="B" style="margin-top: 50px; background-color: Green; clear: right;">Bravo</div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have html code that looks roughly like this: <div id=id1> <div id=id2> <p>some
Let's say I have some code like this: <html> <head><title>Title</title></head> <body> <?php if (!$someCondition){
I have some images inside links that I want to essentially look like this:
I have some PHP code that generates a calendar and then outputs html to
I have an HTML textbox that contains some SQL code that I need executed.
I have simple HTML code with some JavaScript. It looks like: <html> <head> <script
I have a web application with bunch of HTML code. There are some style-attributes
I would like to have a custom snippet of html form code that takes
I have the following code for showing some images: HTML: <div class=footer-logos> <ul> <li><img
I have the following HTML / CSS: <table> <tr> <td> <div> <pre> <code> This

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.