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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T14:20:36+00:00 2026-05-25T14:20:36+00:00

I am trying to style a background of a div by using a top

  • 0

I am trying to style a background of a div by using a top and bottom image for a drop shadow effect like so:

<div id='topline' style='background-image:url("topline.png"); background-repeat:no-repeat; height:10px'></div>
<div id='boxcontent' style='background-image:url("contentline.png"); background-repeat:repeat-y;'>
  [some content]
</div>
<div id='bottomline' style='background-image:url("bottomline.png"); background-repeat:no-repeat; height:10px'></div>

this works fine with the content, but as soon as there is no content the top and bottom divs are of course still displaying. Any ideas on how to improve this so that the entire box does not display unless it contains content?

Thanks

  • 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-25T14:20:36+00:00Added an answer on May 25, 2026 at 2:20 pm

    Assuming that there is more than one “box” on the page, you will need to change your ids to classes… as ids need to be unique to the page.

    Having done that, you could do something like this with jQuery

    $(‘.boxcontent:empty’).hide();

    Example: http://jsfiddle.net/h5S9B/

    Sorry @hofnarwillie. Forgot about hiding the other pieces. Revised:

    if($('.boxcontent:empty')){
        $('.boxcontent:empty').hide(); 
        $('.boxcontent:empty').prev().hide();
        $('.boxcontent:empty').next().hide();    
    }
    

    Example 2: http://jsfiddle.net/h5S9B/1/

    You could then turn this into a function for reuse:

    var e = $('.boxcontent:empty'); 
    
    function hideBoxes(e){
        if(e){
            e.hide();    
            e.prev().hide();
            e.next().hide();    
        }
    }
    
    hideBoxes(e);
    

    Example 3: http://jsfiddle.net/h5S9B/2/

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

Sidebar

Related Questions

I'm trying to style a table row using both cycle and a helper, like
I am using JavaScript and trying to make a skew effect on a div.
I'm trying to create a simple menu pop-up effect using anchors within a div
I am trying to style an input-box rendered using jEditable . I want to
I'm trying to style all <select> elements that are a descendant of a <div>
I'm trying to get the nav-bar to position over the image using CSS. Yet,
https://i.stack.imgur.com/bhrYD.png here is a screenshot I am trying to style it such that the
I am trying to create a drop down menu using CSS and HTML, it
I'm trying to make the footer stay at the bottom using CSS, - sticky
I'm trying add a tab to my web page that looks like this: Using

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.