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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T17:23:40+00:00 2026-06-17T17:23:40+00:00

I have a 1920×650 image and a transparent, horizontal rectangle at bottom left hand

  • 0

I have a 1920×650 image and a transparent, horizontal rectangle at bottom left hand side of it. I’ve managed to make it scale with the image. Problem is I can’t figure out how to make it scale in a way that it would lose more of it’s width. It scales exactly with the img.

.container{
    position: relative;
    width: 100%;
    height: 100%;}

.bg-img{
    display:block;
    position: relative;
    width: 100%;
    height: 100%;
    z-index:1;}

.transblock{
    position:absolute; 
    width:44%; 
    height:6%; 
    top:90%; 
    left:0%; 
    z-index:5;}

http://jsfiddle.net/FA7XE/2/ – Start full screen, scale window down – the box & text drifts too much to middle. (it scales perfect with the image, which is a bad thing in this case 🙁 ). I’d like to have it stay in place relative to the menu below. Any ideas how to do that? 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-06-17T17:23:41+00:00Added an answer on June 17, 2026 at 5:23 pm

    The containers used to display the green rectangle and the text use procentual widths. Looking at the CSS you’ll see that there is no fixed width specified for the parent elements. This will translate to browsers taking the body width value and using it to compute the dimensions.

    Basicaly you’ll always have a width of 44% (taken from the body width) for ‘.transblock’ div and a width of 30% for the ‘.h1text’ div.

    A workaround to achieve the desired effect could be the use of a bit of javascript(jQuery) code to dynamically compute the width and position of the elements:

    jQuery('.transblock').width(jQuery('body').width() * 0.44);
    jQuery('.h1text').width(jQuery('body').width() * 0.3);
    jQuery('.h1text').css('left', jQuery('body').width() * 0.135);
    

    You can take a look at this fiddle

    Note: Take care of how you use the width and the height on the images. Setting width: 100%; and height: 100%; on non-square images might end up with unwanted aspect ratio:

    .bg-img{
        width: 100%;
        height: 100%;
    }
    

    It will suffice to specify width: 100% – browsers will make the image fit the container without forcing the height of the image, keeping the ratio at 1:1.

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

Sidebar

Related Questions

have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
have a nice day. I got problem when trying to create an image from
I have question about site performance. I have 4 large images (1920*500px) that need
I have the following validator for the year of birth: <f:validateLongRange minimum=1920 maximum=1992 />
I have 3divs left, center, right The problem is that left need to be
I have a little problem with Excel. I nead to make a function that
I have an app that uses the camera, with a gun image overlaid as
i want to make a folder with the project id and then i have
I'm trying to make a java RAT but atm I only have screen displaying.
I have a 1920x100 image which is inserted at the top of my page:

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.