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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:21:51+00:00 2026-05-28T19:21:51+00:00

I have a large image iI want to set as background for a div.

  • 0

I have a large image iI want to set as background for a div. But the image is rather large. Here it is:

https://i.stack.imgur.com/vaupg.png

On ther right hand side it will contain text.

How would I go about doing this without having to load such a large image with css?

  • 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-28T19:21:52+00:00Added an answer on May 28, 2026 at 7:21 pm

    If you want to add plain text on top of the image you can just use positioning to place a child element in the correct place:

    HTMl —

    <div>
        <span>Text Goes Here</span>
    </div>
    

    CSS —

    div {
        position   : relative;
        background : transparent url(http://i.imgur.com/4apfI.png) 0 0 no-repeat;
        width      : 530px;
        height     : 128px;
    }
    div span {
        position : absolute;
        top      : 20px;
        right    : 20px;
        width    : 330px;
        height   : 80px;
        overflow : hidden;
    }
    

    Here is a demo: http://jsfiddle.net/XhJZW/

    Update

    You’re image is pretty simple, you can re-create it with CSS gradients like this:

    HTML —

    <div>
        <span class="left"></span>
        <span class="right"></span>
        <span class="content"></span>
    </div>
    

    CSS —

    div {
        position : relative;
        width    : 530px;
        height   : 128px;
    }
    div .left, div .right {
        position : absolute;
        border   : 1px solid #a5a5a5;
        
      -webkit-border-radius: 12px; /* Saf3-4, iOS 1-3.2, Android ≤1.6 */
         -moz-border-radius: 12px; /* FF1-3.6 */
              border-radius: 12px; /* Opera 10.5, IE9, Saf5, Chrome, FF4, iOS 4, Android 2.1+ */
    
      /* useful if you don't want a bg color from leaking outside the border: */
      -moz-background-clip: padding; -webkit-background-clip: padding-box; background-clip: padding-box;
        
        background: rgb(255,255,255); /* Old browsers */
        background: -moz-linear-gradient(top, rgba(255,255,255,1) 0%, rgba(188,188,188,1) 99%); /* FF3.6+ */
        background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,1)), color-stop(99%,rgba(188,188,188,1))); /* Chrome,Safari4+ */
        background: -webkit-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(188,188,188,1) 99%); /* Chrome10+,Safari5.1+ */
        background: -o-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(188,188,188,1) 99%); /* Opera 11.10+ */
        background: -ms-linear-gradient(top, rgba(255,255,255,1) 0%,rgba(188,188,188,1) 99%); /* IE10+ */
        background: linear-gradient(top, rgba(255,255,255,1) 0%,rgba(188,188,188,1) 99%); /* W3C */
        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#bcbcbc',GradientType=0 ); /* IE6-9 */
    }
    div .left {
        top     : 0;
        left    : 0;
        width   : 165px;
        height  : 108px;
        z-index : 2
    }
    div .right {
        top     : 6px;
        left    : 143px;
        width   : 350px;
        height  : 97px;
        z-index : 1;
    }
    div .content{
        position : absolute;
        top      : 15px;
        right    : 45px;
        width    : 300px;
        height   : 80px;
        overflow : hidden;
        border   : 1px solid #000;
        z-index  : 3;
    }
    

    Here is a demo: http://jsfiddle.net/XhJZW/3/

    The above CSS is approximately 2KB. About a quarter of the PNG image.

    Note that browsers will render the gradients and the border-radius differently depending on what the browser supports. The oldest browsers will just see a couple of grey boxes on top of each other (no rounded corners and no gradients).

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

Sidebar

Related Questions

I have a site that uses a large centered background image, which naturally loads
I have a large non-map image that I want to allow people to view
I have a swing component which draws a fixed large (but fixed) vector image
I want to set a background image to my Activity. I am just using
I have a very large image (600mb) 30000x30000 and want to load it into
I have large set of images with .PNG extension (say image00.PNG). I want to
I have a page that has a large image on it with a number
I'm implementing panning of a large image in a PictureBox control, and I have
I have a large, hi-def JavaScript-intensive image banner for a site I'm designing. What
I have an interface that has large numbers of controls, see image below. Interface

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.