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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T05:11:22+00:00 2026-05-12T05:11:22+00:00

hey guys, how can I just achieve this simple layout? I’m hoping the answer

  • 0

hey guys, how can I just achieve this simple layout? I’m hoping the answer will help me understand the basics of css layout and floats.

    <div id="verticalElement1">
        <div id="horizontalElement1">
            some content
        </div>
        <div id="horizontalElement2">
            some content
        </div>
    <div>
    <div id="verticalElement2">
        <div id="verticalElement3">
            some content
        </div>
        <div id="verticalElement4">
            some content
        </div>
    <div>

Ok, so, as the “id”s suggest, I’d like the vertical elements to sit one on top of each other.

inside the top element, I’d like the 2 horizontal elements to sit next to each other.

I want to achieve this without applying “inline” to any elements.

Also, I don’t want to use absolute positioning, unless its relative to some element, and scales nicely.

I’d like to achieve all this with very clean and scalable CSS, in such a way that i can add and remove elements, without having to change style values. Everything should be done by just applying the appropriate classes to certain elements, something like this:

    <div id="verticalElement1" class="containsHorizontalElements">
        <div id="horizontalElement1" class="isHorizontal">
            some content
        </div>
        <div id="horizontalElement2" class="isHorizontal">
            some content
        </div>
    <div>
    <div id="verticalElement2">
        <div id="verticalElement3">
            some content
        </div>
        <div id="verticalElement4">
            some content
        </div>
    <div>

I’ve tried applying floats but everything goes crazy….help!

cheers

  • 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-12T05:11:22+00:00Added an answer on May 12, 2026 at 5:11 am

    Your vertical containers should simply be displayed as block, which is what div tags are by default. Their inner contents can be either both floated left, or one left and one right. You may also want to set widths on your horizontal elements to ensure that they actually both end up on the same line.

    your html can look like this:

    <div id="container1" class="container">
        <div class="inner-element"></div>
        <div class="inner-element"></div>
    </div>
    <div id="container2" class="container">
        <div class="inner-element"></div>
        <div class="inner-element"></div>
    </div>
    

    css can look like this:

    .inner-element {
        float: left;
        width: 100px;
    }
    

    also, you must remember to clear all your containers that contain floats:

    .container {min-height: 10px;}
    
    .container:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
    }
    

    of course, you would want to name your divs something more semantically correct, like “content” or “wrapper” or something like that that actually describes their purpose rather than how they are supposed to look on the page, ie name something “content” instead of “left-column”

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

Sidebar

Related Questions

Hey guys was hoping you can help me out. been at this for like
Hey guys, this is simple but I can't make it workn... blah! I have
Hey guys i had an idea yesterday. Can you help me with this. Here
hey guys, this might be really stupid, but hopefully someone can help. I'm trying
Hey guys I know that this is probably just a simple sql statement but
Hey guys I'm tired and can't figure this one out so any help would
hey guys having this really simple problem but cant seem to figure out have
Hey guys I can't seem to get the syntax here right, I'm just trying
Hey guys, if anybody can help me out i'd love it... What i have
Hey guys I'm using python and I was just wondering how we can make

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.