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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:34:39+00:00 2026-06-15T07:34:39+00:00

I have a <div> with a fixed width and height floated left, and to

  • 0

I have a <div> with a fixed width and height floated left, and to the right of it I have two other <div>s. I want to have one of the <div>s flush against the left-floated <div>‘s border, and the other indented slightly. Here is what I have at the moment…

<div 
    id="leftDiv"
    style="border:1px solid grey;
        width:300px;
        height:400px;
        float:left;">
        This is a left floated div with a fixed width and height
</div>

<div id="rightDiv">
    <div id="flushDiv">This should be flush.</div>
    <div id="indentDiv" style="padding:25px">This should be indented.</div>
</div> 

But what happens with the above html is that both the <div>s with id’s ‘flushDiv’ and ‘indentDiv’ are flush against the right side of the <div> with id leftSideDiv.

I can why this happens when I set a visible border on the rightDiv. It’s left side is actually flush with the left side of the leftDiv. And both elements are already padded well over the 25px indentation that I want for indentDiv, so they both end up flush against the right side of leftDiv.

If I float rightDiv right, I get the desired indentation effect, almost. indentDiv is now indented with respect to flushDiv, but flushDiv is no longer flush against the right side of rightDiv.

Ok, I’m not even sure I’m following myself anymore.

Does anyone understand what I’m asking and have a solution? I’ll try to sum it up:

How can I have two divs to the right of a left floated div, where one is flush agains the left floated div’s right border, and the other is offset?

  • 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-15T07:34:41+00:00Added an answer on June 15, 2026 at 7:34 am

    Is this what you are trying to accomplish? I put borders around them so you can see them… Here is an example on jsfiddle.com

    http://jsfiddle.net/hawUs/

    <div id="leftDiv" style="border:1px solid grey;width:300px;height:400px; float:left;">
        This is a left floated div with a fixed width and height
    </div>
    
    <div id="rightDiv" style=" float:left;">
      <div id="flushDiv" style="border:1px solid grey; float">This should be flush.</div>
      <div id="indentDiv" style="padding:25px;border:1px solid grey;">This should be indented.    </div>
    </div> ​​​​​​​​​​​​​​​
    

    Update: You can also change the padding on the div #indentDiv to use margin instead. See example: http://jsfiddle.net/hawUs/1/

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

Sidebar

Related Questions

I have a div that I want to specify a FIXED width and height
It seems that in Firefox, if I have div A with fixed width/height and
I have a div element with fixed height and width and overflow:hidden, and I
Consider that we have a DIV with fixed height. Without a defined width ,
If I have a div with a fixed height and width, which I am
I want a div with a fixed width image on the left and a
I have a two-column layout, composed of fixed-width floated divs. Inside the first column
I'm trying to create a div which will have fixed width and flexible height
Objective I have a main DIV with fixed height and width, and in that
I have a div with fixed width and height and overflow:scroll attribute. I would

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.