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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:16:58+00:00 2026-06-05T20:16:58+00:00

Problem: I am trying to align divs next to each other using float:left but

  • 0

Problem:

I am trying to align divs next to each other using float:left but I can’t get it to work. Instead, they are aligning under each other.

PHP code:

while ($row = mysql_fetch_assoc($result))
{
    $kriterium .= '<div style="float:left;">'.$i.'</div>';
    $betyg .= '<div style="float:left;">'.$row['RID'].'</div>';

    $mean += $row['RID'];

    $i++;
}

$meanvalue = round ($mean / ($i-1), 2);

$kriterium .= '<div style="float:left;"><b>Medelv&auml;rde</b></div>';
$betyg .= '<div style="float:left;"><b>'.$meanvalue.'</b></div>';

$html .= '
    <div class="table table-condensed table-bordered neutralize">
        <div>
            <b>Kriterium</b>'.$kriterium.'
        </div>
        <div>
            <b>Betyg</b>'.$betyg.'
        </div>
    </div>';

Desired output:

enter image description here

Question:

What is wrong with the CSS code that needs to be modified so that divs are aligned like columns next to each other?

  • 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-05T20:16:59+00:00Added an answer on June 5, 2026 at 8:16 pm

    You need to set a width for each div. The width of the first div will be wider than the width of the other divs.

    <!DOCTYPE html>
    <html>
      <head>
        <title>Kexx</title>
        <style type='text/css'>
        div.table-bordered > div  {
          width:420px;
        }
        div.table-bordered > div > div.c {
          width:94px;
        }
        div.table-bordered > div > div {
          float:left;
          width:24px;
        }
        div.table-bordered div {
          border:1px solid #333;
        }
        </style>
      </head>
      <body>
        <div class="table table-condensed table-bordered neutralize">
          <div>
            <div class='c'><b>Kriterium</b></div>
            <div>1</div>
            <div>2</div>
            <div>3</div>
            <div>4</div>
            <br style='clear:both;'/>
          </div>
    
          <div>
            <div class='c'> <b>Betyg</b></div>
            <div>A</div>
            <div>B</div>
            <div>C</div>
            <div>D</div>
            <br style='clear:both;'/>
          </div>
        </div>
    
      </body>
    </html>
    

    http://jsfiddle.net/Zv7Dp/

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

Sidebar

Related Questions

So Here is the Problem, I am trying to get that circle to align
having a problem trying to get an arraylist containing arraylists to work in my
I have a small problem. I am trying to align two divs side by
I am trying to get my input field to align to the left of
Never had problems with centering divs before but I have been trying to get
I have a small problem trying to unzip a file using the 7za command-line
I am trying to align differently sized images in a line using the vertical-align
I am trying to get the actionlink to align right for this code. <div
Problem: I'm trying to align two frames of a moving video. I'm currently trying
I was trying to align doubles using string.format and display them on a tooltip.

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.