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

The Archive Base Latest Questions

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

I expected the two span tags in the following sample to display next to

  • 0

I expected the two span tags in the following sample to display next to each other, instead they display one below the other. If I set the width of the class span.right to 49% they display next to each other. I am not able to figure out why the right span is pushed down like the right span has some invisible padding/margin which makes it take more than 50%. I am trying to get this done without using html tables. Any ideas?

* {   margin: 0; }  html, body {   margin: 0;   padding: 0;   height: 100%;   width: 100%;   border: none; }  div.header {   width: 100%;   height: 80px;   vertical-align: top; }  span.left {   height: 80px;   width: 50%;   display: inline-block;   background-color: pink; }  span.right {   vertical-align: top;   display: inline-block;   text-align: right;   height: 80px;   width: 50%;   background-color: red; }
<html>  <head>   <title>Test Page</title>  </head>  <body>   <div class='header'>     <span class='left'>Left Span 50% width</span>     <span class='right'>Right Span 50% width</span>   </div> </body>  </html>


Thanks for the explanation. The float:left works beautifully with expected results in FF 3.1. Unfortunately, in IE6 the right side span renders 50% of the 50%, in effect giving it a width of 25% of the browser window. Setting its width to 100% achieves the desired results but breaks in FF 3.1 which is in standards compliance mode and I understand that. Getting it to work both in FF and IE 6, without resorting to hacks or using multiple CSS sheets has been a challenge

  • 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. 2026-05-10T13:31:39+00:00Added an answer on May 10, 2026 at 1:31 pm
    float: left; 

    Try adding that to span.left

    It will cause it to float to the left (as suggested by the syntax).


    I am not a CSS expert by any means so please don’t take this as unarguable fact but I find that when something is floated, it makes no difference to the vertical position of things below it.

    If you float the span.right to the right then add text beneath them you should get some interesting results, to stop these ‘interesting results’ you can use ‘clear: left/right/both’ which will cause the block with the clear styling to be under anything floated to the left/right/both. W3Schools have a page on this property too.

    And welcome to Stackoverflow.

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

Sidebar

Related Questions

I have two viewControllers, one is a subclass of UIViewController (autoresizes correctly), the other
The expected probability of randomly selecting an element from a set of n elements
I get the following compilation error: error: expected `;' before 'it' Here's my code:
Code below is not working as expected to detect if it is in design
The code below continues many lines until it ends with a expected /veotherwise /vechoose.
I have a methode in a static class and this expected two parameters and
Imagine two servers (each within an own jvm process) which communicate using some form
I have two tables.One table contain the values +---------+ Users ---------+ A B C
I have two objects... and if I compile a program with either one, it
We have two distinct agile teams, each working on separate, but related, applications. Each

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.