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

  • Home
  • SEARCH
  • 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 6227845
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T09:17:23+00:00 2026-05-24T09:17:23+00:00

I’m trying to use <div> objects and CSS to emulate the appearance of frames

  • 0

I’m trying to use <div> objects and CSS to emulate the appearance of frames for a project that I’m working on. Using the following code I was able to properly stretch the list on the left with a border-right, padding, and (if I choose) a background using only one extra element:

HTML:

<div id="sidebar">
    <div id="sidebar-content">
        <!-- content goes here -->
    </div>
</div>
<div id="content">
    <!-- more content -->
</div>

CSS:

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

#sidebar {
    float: left;
    height: 100%;
    width: 200px;
    overflow: auto;
    border-right: solid 1px #000;
}

#sidebar-content {
    margin: 10px;
    padding: 0;
    list-style: none;
}

#content {
    position: relative;
    float: left;
    padding: 10px;
}

This worked well until I tried adding another element at the top of the content which stretched horizontally. Here’s the current code:

HTML:

<div id="content">
    <div id="criteria">
        <!-- select boxes -->
    </div>
    <!-- other content -->
</div>

CSS:

#criteria {
    position: absolute;
    left: 0;
    right: 0;
    background: #FF9;
}

This picture shows the results

Results of the above CSS and HTML

I tried adding the following rule:

#content {
    width: 100%;
}

although this stretched the #content div to the width of the body element, not the body minus the sidebar – so the content appeared below the fold (and beneath the sidebar on the left)

How can I use CSS to stretch the criteria box to fill the content area horizontally?

EDIT –

I wanted to upload a picture of what happened after Karl’s recommendation:

Remove the float: left from #content. If there is a floated element next to a normal block element, the block element will fill the remaining space. Also don’t set the width attribute.

Here’s what happened when float: left was removed

Results of the above recommended fix

Close, however now the #criteria is stretching to cover up the sidebar. Other suggestions?

  • 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-05-24T09:17:24+00:00Added an answer on May 24, 2026 at 9:17 am

    Remove the float: left from #content. If there is a floated element next to a normal block element, the block element will fill the remaining space. Also don’t set the width attribute.


    Edit:

    To address the issue of #criteria which is absolutely-positioned forcing itself over to the left, you can add a left-margin to #content to account for the width of the sidebar, as Steven discovered.

    As a random sidenote, this would also allow you to keep the content aligned in the case that the sidebar did not take 100% height like it does in Steven’s example.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm trying to create an if statement in PHP that prevents a single post
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.