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

The Archive Base Latest Questions

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

I have a simple blog page – a list of posts that each consist

  • 0

I have a simple blog page – a list of posts that each consist of a title and contents. When the page loads I want all posts’ contents hidden until their titles are clicked. The following code accomplishes this but with an unwanted side effect – the on-page-load hide() function that hides each post’s content also hides the background of the containing (id=”content”) div:

Relevant JavaScripts:

$(document).ready(function() {

    $(".blog_post p").hide();

    //BLOG CONTENT ANIMATION
    $('.blog_post').click(function() {
        $(this).find('p').slideToggle(130);
    });      
});

Summary of blog page:

<section class="grid_7">
<div id="content">

    <div class="blog_post">

        <div class="blog_head">
            <h2>Title</h2>
        </div>

        <p>Contents</p>

    </div>

</div>
</section>

Relevant CSS:

section { 
    border: 1px solid white;
}

#content {
    margin: 20px;
    background-image:url('../images/content_background.jpg');
}

When the page loads the list of titles displays without the #content parent div’s background. However when I click on a post’s title the #content div’s background shows up behind all posts up to and including that one.

Any idea what’s going on?

  • 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-23T01:17:41+00:00Added an answer on May 23, 2026 at 1:17 am

    It sound like you have some CSS that applies to the blog_head elements, that makes them float, for example:

    .blog_post { float: left; }
    

    In that case, the reason that the background doesn’t show up is that the height of the content div is zero. A floating element doesn’t affect the size of its parent, and when the content div only contains the headers, the height becomes zero. The background is still there, but there is no area where it’s visible.

    Add an overflow to the content div, that will make it contain its children:

    #content { overflow: hidden; }
    

    Note that this will not hide anything as long as you don’t specify a size for the content element, it will just change how it’s rendered so that it will become a container for its children.

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

Sidebar

Related Questions

Let's say you have this scenario:a simple blog home-page that loads both static content
I have a really simple blog application and I want to add a really
Thanks in advance! I have a simple mysql and php blog that I built
I create a simple blog with cakephp where i have some posts and some
I have simple page using a two-column page layout that breaks on zooming. Here
I have a question. I own a 128mb vps with a simple blog that
I want to build a simple blog which contains: A home page with blogs
I have an asp.net page for a simple blog which looks like <asp:TextBox ID=txtContent
I have a wordpress blog. I made a custom page-template that allows users to
Have a painfully simple blog Post creator, and I'm trying to check if 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.