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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:23:04+00:00 2026-06-04T09:23:04+00:00

I got this to run properly giving my wrapper a black bg with an

  • 0

I got this to run properly giving my wrapper a black bg with an opacity on it. the problem comes when i try to change the bg color to have no opacity my content seems to drop behind the bg image.

the code

<img src="bg.jpg" id="bg" alt="">
<div class="wrapper">
    <div class="main">
        <h1>Full Screen</h1>
        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce tempus, sem id feugiat lobortis, felis velit dignissim sem, et pretium orci est et magna. Nunc non massa id odio ultrices varius. Nulla consequat sollicitudin erat sed condimentum. Cras vel magna ut tellus rhoncus dictum. Nulla dictum adipiscing quam vel condimentum. Aliquam accumsan quam in libero vehicula vel sodales justo tempus. Duis mattis leo a urna feugiat eleifend. Suspendisse cursus molestie est ornare sodales. Sed justo risus, mattis a tincidunt facilisis, mattis porta tortor. Nunc ac quam justo.</p>
    </div>
</div>

the css

#bg { 
    position: fixed; top: 0; left: 0; 
}
.bgwidth {
    width: 100%;
}
.bgheight {
    height: 100%; 
}
.wrapper{
    width:960px;
    /*border-radius: 10px;
    -webkit-border-radius: 10px;
    -moz-border-radius: 10px;
    box-shadow: 0px 0px 10px #000;
    background-color:#000;
    filter: alpha(opacity=30);
    opacity: 0.3;*/
    background-color:#000;
    margin-left:auto;
    margin-right:auto;
}

the js

$(window).load(function() {    

    var theWindow        = $(window),
        $bg              = $("#bg"),
        aspectRatio      = $bg.width() / $bg.height();

    function resizeBg() {

        if ( (theWindow.width() / theWindow.height()) < aspectRatio ) {
            $bg
                .removeClass()
                .addClass('bgheight');
        } else {
            $bg
                .removeClass()
                .addClass('bgwidth');
        }

        var newWidth = theWindow.width()-$bg.width();
        var newHeight = theWindow.height()-$bg.height();
        //alert(newWidth + "-"+ newHeight);
        $bg.css("left",(newWidth/2)+"px");
        $bg.css("top",(newHeight/2)+"px");
    }

    theWindow.resize(function() {
        resizeBg();
    }).trigger("resize");

});
  • 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-04T09:23:06+00:00Added an answer on June 4, 2026 at 9:23 am

    I’ve updated @deltree’s jsfiddle. http://jsfiddle.net/trickeedickee/79aXy/2/

    You need to add position: relative; to your .wrapper when you remove the opacity and it will work for you.

    .wrapper {
        position: relative;
        }
    

    I hope this helps.

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

Sidebar

Related Questions

This problem has got me stumped for a few days now. I have a
I got this error E/AndroidRuntime(475): java.lang.NoClassDefFoundError: com.google.gdata.client.youtube.YouTubeService When I try to run Youtube data
I was trying to run a request factory example, but, I got this error
Say I've got something like this public void run(){ Thread behaviourThread = new Thread(abstractBehaviours[i]);
I've got this code trying to run a simple set of images in a
This code does not run properly, but it suggests what I am trying to
I have got this error when using Enterprise Library 3.1 May 2007 version. We
I have run into an interesting problem with Entity Framework and based on the
Got this line of code here but its not working. private void Button_Click(object sender,
Got this site with UN/PW set via the Createuserwizard control. Client considers PW too

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.