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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:53:14+00:00 2026-05-25T00:53:14+00:00

I have a big image, and some text that I would like to lay

  • 0

I have a big image, and some text that I would like to lay out in two columns, both 50% width, with the text in the right hand column and the image in the left hand column. I’d like the left hand column to take its height from the text in the right, and for the centre of the image to be in the centre of the left hand column, both vertically, and horizontally.

So something like this:

[             ]|[----Text-----]
[             ]|[-------------]
[             ]|[-------------]
[    Image    ]|[-------------]
[    Centre   ]|[-------------]
[             ]|[-------------]
[             ]|[-------------]
[             ]|[-------------]

The standard trick to get the height of the left hand column to match that of the right hand column is to put a container div around both columns so the left column can be full height in that, and to allow the right column to sit on top of the left. So something like this.

<div class="container">
    <div class="right-column">Lorem ipsum dolor sit...</div>
</div>
div.container {
    background-image: url(my_big_image.jpeg);
    background-position: ?;
    float: left;
    width: 100%;
}

div.right-column {
    float: right;
    background: white;
    width: 50%;
}

But then how do I get the centre of my image to the centre of the column on the left? It seems I need the container div to include the right column in order to get the height right, but I need to exclude it in order to get the image centered horizontally in the left column.

Ideally, I’d like to do this without using JavaScript!

  • 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-25T00:53:15+00:00Added an answer on May 25, 2026 at 12:53 am

    You could certainly do this with jQuery, but here is a CSS only method:

    DEMO:
    http://jsfiddle.net/skylar/zXqQB/

    HTML:

    <div id="container">
        <div id="text">
            <div id="image"></div>
            Lorem ipsum dolor sit amet..
        </div>
        <div class="clear"></div>
    </div>
    

    CSS:

    #container { position:absolute; }
    #image {
        position:absolute;
        left:0;
        width:50%;
        height:100%;
        background-color: #ccc;
        background-image: url(http://www.maniacworld.com/have-a-nice-day.jpg);
        background-position: center center;
        background-repeat: no-repeat;
    }
    #text { margin-left:50%;}
    .clear { clear:both; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given that we have the following View: <StackPanel> <TextBlock Text=Some text/> <Image Source={Binding vmImageProp}
I have a big image that has to go in the background. Say the
I have a piece of code that load a very big image in memory.
I have an image that is too big and I want to put it
i have a script that creates divs with some background image then moves them,
I have a big html page, like 4000x6000 px with images and text. I'd
I'm working on some image transformations using ASP.NET/C#/GDI+. I have a method that looks
I have taken an image from UIImagePickerController , but the file looks too big
I have big system that make my system crash hard. When I boot up,
I have big element at the top of the webpage that sides down with

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.