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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:24:54+00:00 2026-06-05T10:24:54+00:00

I am pulling my hair out because I just cannot figure this out. I

  • 0

I am pulling my hair out because I just cannot figure this out. I am developing a wiki. A typical page has a sidebar to the right with a fixed width. To the left of this sidebar is text, div’s, tables, etc. (the content of the page). Basically, I want everything to be at full width – that means if it’s next to the sidebar, it should be the full width minus the length of the sidebar. If it’s not next to the sidebar, it should be the full width of the page. Like this:

 _______________________________
|                          ___  |
| text text text text te- |   | |
| xt text text text text. | S | | 
| ______________________  | B | |
| |                     | |   | |
| |        table        | |___| |
| |          or         |       |
| |         div         |       |
| |_____________________|       |
|                               |
| more text text text text tex- |
| t text text text text text t- |
| ext text text text text text  |
| ____________________________  |
| |        another table      | |
| |             or            | |
| |            div            | |
| |___________________________| |
|_______________________________|

In the case of text, it all wraps around the sidebar perfectly. If I have a super long sentence, it goes all the way to the left of the sidebar, then breaks to a new line. If I have a super long paragraph, all of the text bumps up right next to the sidebar and also goes right underneath it.

However, the problem I’m having is when I want to put a div to the left of the sidebar. When set to 100%, the div does not take into consideration the width of the sidebar and expands to the full width of the page, thus overlapping the sidebar. Normally I would just set the div to have a margin-right of the width of the sidebar. However, for my purposes, this isn’t going to feasible because on different screen resolutions, the div might be lower on the page below the sidebar and thus there will be a blank gap to the right of the div (plus it would just be easier for coding purposes to figure this problem out so the page’s div’s know how wide they should be themselves). For example, in my text picture above, if the page were skinnier because it’s on a lower screen resolution, the first box would probably be underneath the sidebar. With a margin-right of the sidebar, this would mean there would be a big gap to the right of the box and that it would not be the full width of the page.

This is the code I’m using.

<html>
<head>
<style type="text/css">#sidebar {
float: right;
width: 250px;
height: 200px;
border: 1px solid red;
}

#la {
border: 1px solid green;
width: 100%;
}
</style>
</head>
<body>

<div id="content">

    <div id="sidebar">Sidebar with fixed width</div>

    <p>The sun is a star.</p>
    <p>It's yellow.</p>
    <p>It's very hot.</p>

    <div id="la">This div is next to the sidebar and should bump up right next to its left side, as in, 100% of the page minus the width of the sidebar. It should not overlap the sidebar. This is not something that can just be done automatically with margin-right using the width of the sidebar because it might not actually be next to the sidebar on certain screen resolutions.</div>

    <p>The sun is a star.</p>
    <p>It's yellow.</p>
    <p>It's very hot.</p>

    <div id="la">This div is NOT next to the sidebar on most screen resolutions - it is under it where there is nothing to the right of it, so it should be the full width of the page.</div>


</div>

</body>
</html>

I’m hoping there’s a way to just make it so that if something is next to the sidebar, such as a table within a div, it’ll be at the max width of the page minus the width of the sidebar. If it’s not next to the sidebar, it’s the full width of the page. I guess I just want everything else to act like text – it’ll go right up to whatever is to the right of it (either the sidebar if it’s there or the right side of the page if the sidebar is not there).

  • 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-05T10:24:57+00:00Added an answer on June 5, 2026 at 10:24 am

    Write like this:

    CSS

    .right{
        float:right;
        width:60px;
        height:60px;
        background:green;
    }
    .left{
        overflow:hidden;
        border:2px solid yellow;
        background:red;
        height:60px;
    }
    

    HTML

    <div class="right">right</div>
    <div class="left">left</div>
    

    Check this http://jsfiddle.net/rq5WX/

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

Sidebar

Related Questions

I'm pulling my hair out here, because I just can't seem to get this
I am pulling my hair out trying to figure this out because I had
I'm pulling my hair out right now because of this. I have downloaded and
This has me pulling my hair out. Button on site has onclick=method() and it's
I've been pulling my hair out this morning trying to figure this out. I
I have been pulling my hair out because of this. My cucumber step clicks
I've been pulling out my hair to figure out this segfault and decided to
I have been pulling my hair out because of this 1 line of code.
I've been pulling my hair out because of this: I'm trying to extract the
This problem of mine has me pulling my hair out. It's related to the

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.