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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:02:44+00:00 2026-06-13T11:02:44+00:00

I have thrown a quick example in jsfiddle to show you what is happening

  • 0

I have thrown a quick example in jsfiddle to show you what is happening and then I will explain what I want to achieve..

http://jsfiddle.net/4UMLq/20/

(code html – in jsfiddle)

<html>
<head>
</head>
<body>
    <div class="box1top">
    </div>
    <div class="box1middle">
        <p> Test </p><br />
        <p> Test </p>
    </div>
    <div class="box1bottom">
    </div>
        <div class="box1top">
    </div>
    <div class="box1middle">
        <p> Test </p><br />
        <p> Test </p>
    </div>
    <div class="box1bottom">
    </div>
</body>
</html>​

(code css – in jsfiddle)

.box1top {
    width: 150px;
    height:30px;
    background-color:#373737;
    margin-left:10px;
    margin-right:10px;
    margin-top:10px;
}
.box1middle {
    width: 150px;    
    height:200px;
    background-color:#676767;
    margin-left:10px;
    margin-right:10px;
}
.box1bottom {
    width: 150px;
    height:10px;
    background-color:#373737;
    margin-left:10px;
    margin-right:10px;
}
.box2top {
    width: 150px;
    height:30px;
    background-color:#373737;
    margin-left:10px;
    margin-right:10px;
}
.box2middle {
    width: 150px;    
    height:200px;
    background-color:#676767;
    margin-left:10px;
    margin-right:10px;
}
.box2bottom {
    width: 150px;
    height:10px;
    background-color:#373737;
    margin-left:10px;
    margin-right:10px;
}

In the example above the bg colours are going to be images for boxes that will contain text (split into 3 images)

However I want to display these side by side in the browser window instead of underneath one another.. I have tried floating the elements ect and I just cant seem to get this right?

Has anyone got any ideas? Any help is appreciated

Thanks,
Carlos

  • 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-13T11:02:45+00:00Added an answer on June 13, 2026 at 11:02 am

    A general principle when coding (anything) is to keep it DRY (don’t repeat yourself).

    See here: http://jsfiddle.net/4UMLq/21/

    Luckily, CSS allows us to accomplish this easily:

    .box{
        float:left;
        margin:10px 10px 0 10px;
        width: 150px;
    }
    
    .box-top {
        height:30px;
        background-color:#373737;
    }
    .box-middle {   
        height:200px;
        background-color:#676767;
    }
    .box-bottom {
        height:10px;
        background-color:#373737;
    }
    
    #box2{
        margin-left:0;
    }
    

    HTML:

    <div id="box1" class="box">
        <div class="box-top">
        </div>
        <div class="box-middle">
            <p> Test </p>
            <p> Test </p>
        </div>
        <div class="box-bottom">
        </div>
    </div>    
    <div id="box2" class="box">
        <div class="box-top">
        </div>
        <div class="box-middle">
            <p> Test </p>
            <p> Test </p>
        </div>
        <div class="box-bottom">
        </div>
    </div>
    

    Note that the top, middle, and bottom divs are each nested inside of a “box” div. There is no reason to create duplicate boxNtop, etc CSS definitions, because many elements may share the same class name. So, if you want them all to look the same, it is easily done.

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

Sidebar

Related Questions

i have about 20 possible exception messages that i want thrown when an error
I have thrown together a quick prototype to try and establish a few very
I want to create a quick function that will console.log a variable name and
I have a date in the following format: 2010-03-01T00:00:00-08:00 I have thrown the following
I have a ClassCastException being thrown saying that I'm trying to cast a SeekBar
I have an exception being thrown from a C# method, that takes a generic
I have a page on which I've thrown a LinqDataSource and a GridView. I've
I have a HttpModule in C# 2.0 which handles exceptions thrown. Whenever the exception
I have some code which asserts an exception is thrown when a method is
Related: Cannot view exceptions thrown during Tomcat startup from Eclipse I have Eclipse setup

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.