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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:30:25+00:00 2026-05-26T06:30:25+00:00

I need to split the background of an html page in 2 (horizontally). The

  • 0

I need to split the background of an html page in 2 (horizontally). The top and bottom part will have a different background image/texture, that will be repeated, in other words expandable with the window’s size.
On top of this “split background”, I want to display some content, like texts or images.

This code generates a “split background” like I want, but I can’t/don’t know how to put content on top of that…

<html>
<head>
<style type="text/css">
html{height: 100%;}
body { width: 100%; height: 100%; }
.top { width: 100%; height: 50%; background-image:url('img/top.jpg'); }
.bottom { width: 100%; height: 50%; background-image:url('img/bottom.jpg'); }
</style>
</head>

<body>
<div class="top"></div>
<div class="bottom"></div>
</body>

</html>

The content should be centered vertically and horiontally on top of this “split background”. I tried to use a third div, play with z-indexes and use the css3 multiple bg feature, but I couldn’t get the result wanted.
Any 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-26T06:30:26+00:00Added an answer on May 26, 2026 at 6:30 am

    Ok at the end I couldn’t find a solution in CSS. The content image I was placing over the 2 other divs would not align correctly if the browser window was too small…

    I solved it using some javascript, since the site I develop already contains Javascript, it wasn’t an issue.

    Here is the html:

    <html>
    <head>
    <link href="css/reset-min.css" rel="stylesheet" type="text/css">
    <link href="css/styles.css" rel="stylesheet" type="text/css">
    
        <script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
    
        <script type="text/javascript">
            $(document).ready(function(){
    
                $(window).resize(function(){
    
                    $('.content').css({
                        position:'absolute',
                        left: ($(window).width() 
                          - $('.content').outerWidth())/2,
                        top: ($('body').height() 
                          - $('.content').outerHeight())/2
                    });
    
                });
    
           //To initially run the function:
           $(window).resize();
    
        });
        </script>
    
    </head>
    
    <body onload="$(window).resize()"> <!-- needed to correct loading bug -->
    
        <div class="top"></div>
        <div class="bottom"></div>
    
        <div class="content">
             <img alt="Content" src="img/01_illustration.png" /> 
        </div>
    </body>
    </html>
    

    And the css:

    html, body { width:100%; height: 100%; }
    
    body { min-height: 768px; min-width: 1024px; }
    
    
    .top { width: 100%; height: 50%; background-image:url('img/01_texture_top.jpg'); }
    .bottom { width: 100%; height: 50%; background-image:url('img/01_texture_bottom.jpg'); }
    
    .content {}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to split an amount into multiple part and insert into an table
I need to split comma delimited string into a second columns I have the
I am creating an animation that changes the value of a background image. It
Background: I have a winform application written in VB.NET that uses a WebService to
I need to write some code that performs an HTML highlight on specific keywords
I have a task to complete for work. I have a HTML page with
I have a problem in HTML. I have divided the HTML page into two
Background: I need to create an NDIS filter intermediate driver. This driver will pass
following background: i have a Table-valued Function that returns a Table that is a
I have a string that I am creating, and I need to add multiple

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.