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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:54:17+00:00 2026-05-16T03:54:17+00:00

<style> div#float { text-align: center; float: left; width: 150px; height: 150px; border: 1px solid

  • 0
<style>

div#float {
    text-align: center;
    float: left;
    width: 150px;
    height: 150px;
    border: 1px solid blue;
    background: gold;
}
div.content {
    background: yellow;
    border: 1px solid  purple;
    height: 150px;
}

</style>

            <div id='float'>
                Float text. 
            </div>
            <div class='content'>
                Content text. 
            </div>
            <div class='content'>
                Content text. 
            </div>

can anyone explain how the 2nd div content is on the newline ? while the 1st div is inline with div#float?

  • 1 1 Answer
  • 1 View
  • 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-16T03:54:18+00:00Added an answer on May 16, 2026 at 3:54 am

    By default, divs will take up the entire width of the block. Your first one is just beginning after the floated div because that’s where it can begin. Since both your content divs are block-level elements, they will take up the entire width available to them.

    There are lots of ways to control this, but I’m not sure what you’re after.

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

Sidebar

Related Questions

Given this simplified snippet : <html> <body> <div> <div style='text-align:center;'>asdfaskjdfakjsd</div> <div style='float:right'> <input type='submit'
My navigation panel currently has the following attributes: <div id='navpanel' style='float:left; width:300px; height:100%; overflow:hidden;
<html> <head> <title> Learning CSS </title> <style type=text/css> #header { padding:1px; margin:1px; border:1px solid
I've got this php code that works perfectly: preg_match_all( '/<div style=display:block; float:left; height:240px; width:150px;'
'<div id="'+div_id+'" class="widget" style="height:60px;width:110px">\n\ <div class="widget-head ui-widget-header" style="cursor:move;height:20px;width:130px">'+ '<span id="'+span_id+'" style="float:right; cursor:pointer" class="dialog_link ui-icon
I want the style of three div align as same as the following picture.
I have this CSS style that does a rounded corners for div border, but
I'm having trouble left aligning a related links div inside a block of text,
I have defined styles for <li> #mainNav{clear:both;background-image: url(../images/bg_menu.jpg);width:975px;height:43px;color:#fff;margin-top:-25px;} #mainNav ul{list-style: none;padding: 0;margin: 0;} #mainNav
i am trying to style a div with box-shadow and gradient cross-browsed. I am

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.