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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:39:18+00:00 2026-06-04T08:39:18+00:00

So I have a div and two spans: <div class=A> <span class=B></span> <span class=C></span>

  • 0

So I have a div and two spans:

<div class="A">
    <span class="B"></span>
    <span class="C"></span>
    <span class="clear"></span>
</div>

Assume that B and C has sufficient contents. The CSS snippet is:

.A { position: absolute; } /* I need this to be absolute */
.B, .C { float: left; }
.clear { clear: both; }

But I keep getting the layout of the right image, while I want it to be like layout of first image (refer to image below)
enter image description here

Please help me. And it would be better if you kindly explain a bit why do they happen and why is my code not working like I expected. How is float actually working. 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-06-04T08:39:20+00:00Added an answer on June 4, 2026 at 8:39 am

    Your classes in the html are capitals but not in the CSS?

    EDIT:

    .A { position: absolute; border: 1px solid blue; } 
    .B, .C { float: left; border: 1px solid red; width: 100px; height: 20px; }
    .C { height: 100px; }
    .clear { clear: both; }
    <div class="A">
        <span class="B"></span>
        <span class="C"></span>
        <span class="clear"></span>
    </div>

    Demo on JSFiddle

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

Sidebar

Related Questions

I have two div elements that are twins (i.e. their dimensions and contents are
I have two divs as follows: <div class=car-service id=browse-all-button> <p>CAR SERVICE</p> <span>56 Race Ramps</span>
I have this HTML code: <span id=one>one</span> <div> <span>two</span> </div> <span id=click>click</span> $(#click).click(function(){ $(this).css('color',
In the following HTML page, I have a div, which contains two spans (
I have two div -elements, the top one has the height of 40% and
I have two div's one has textbox in it and other just plain text.
I have a div that contains two other divs,, like this: ---------------------------- | |
Suppose you have a Django view that has two functions: The first function renders
I have two types of links that are event-bound. If the clicked-on link has
I have two divs , on hover span class=fg grows and changes opacity, span

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.