Image in the footer overlay

I'm facing an issue with my fullscreen cover background. I want to overlay a footer that darkens the background, as well as place an image on top of it which also needs to be darkened. I attempted using z-index and a sliced image with transparency, but it just showed up as blue and didn't work.

#footer {
height: 100px;
opacity: 0.4;
background-color: #000000;
}
html { 
  background: url(background.jpg) no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  height: 100%;
  width: 100%;
}

Any assistance would be greatly appreciated.

Edit:

To resolve the issue, I simply added another div element above with a negative margin without utilizing z-index at all.

    <div id="footer">
    </div>
    <div id="footer-main">
    <img src="uqu-logo.png">
    <p>Have a question? Check out our <a href="#">FAQ</a></p>
    </div>

And here is the CSS:

#footer {
    height: 100px;
    opacity: 0.4;
    background-color: #000000;
    background-image: url('footer-bkg.png');}
#footer-main {
    left: 50%;
    margin-left: -567px;
    margin-top: -82px;
    position: absolute;
color: white;}

Answer №1

To resolve the issue, I simply added another div element above with a negative margin instead of using z-index.

<div id="footer">
</div>
<div id="footer-main">
<img src="uqu-logo.png">
<p>Have a question? Check out our <a href="#">FAQ page</a></p>
</div>

Here is the CSS code:

#footer {
    height: 100px;
    opacity: 0.4;
    background-color: #000000;
    background-image: url('footer-bkg.png');}
#footer-main {
    left: 50%;
    margin-left: -567px;
    margin-top: -82px;
    position: absolute;
    color: white;}

Answer №2

To enhance your webpage, consider including the following code snippet:

#footer { position: relative; z-index: 9999; }

Answer №3

Where is the destination for this image? Which container will it be placed in? As of now, it seems like you want a box overlaid on top of the background with reduced transparency. [jsFiddle] This is technically already achieved.

Could you provide the HTML code as well? Alternatively, insert it into a jsFiddle so we can identify the issue.

If the Z-indexes are not functioning properly, ensure that you assign a z-index to each element and not just to #footer.

#footer {
    height: 100px;
    opacity: 0.4;
    background-color: #000000;
    z-index: 999;
}
#img_div {
    z-index: 1;
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

planning to append the author's name to the end of the title using CSS

Here is the HTML code I have: <div class='store_detail-level1'> <span class='book_name'>How To Avoid Climate Disaster</span> <br> <span class='author_name'>Bill Gates</span> < ...

Creating a Bootstrap layout with a fixed top navigation bar, sidebar, and footer

I have a webpage with four components. Top Navigation Sidebar Footer Main content My goal is to have the Top Navigation fixed at the top, the footer fixed at the bottom, and the sidebar to stick to the left with full height. To achieve this layout, I h ...

Java JLabel HTML displayer shows corrupted text due to font clashes with system font

UPDATED - I faced an issue that has now been resolved in a rather unconventional manner. Is there a better way to handle it? The problem I encountered was related to rendering text in a custom font within HTML in a JLabel, especially when the font name co ...

Is it possible to change the button class within a div while ensuring only the last one retains the change?

Here is a code snippet I'm using to switch between classes for buttons: $('button').on('click', function(){ var btn=$(this); if(btn.attr('class')=='tct-button'){ btn.removeClass('tct-button ...

Transform every URL within the class.phpmailer.php file

After spending 3 weeks searching, I finally stumbled upon these amazing answers >>> How to turn plain URLs into clickable links? However, I am unsure of how to implement this with phpmailer.. I have been utilizing an html form to send informatio ...

Take charge of JavaScript over CSS using Flash technology

Optimal scenario/arrangement: Imagine a webpage with one Flash movie and a separate section containing several hyperlinks. Each of these hyperlinks is given a distinct class name, like this: Copy code <ul> <li><a href="" class="randomna ...

Validation message does not seem to be disappearing on input

My form validates input fields, including textboxes and radio buttons. The validation error messages display correctly when trying to submit the form with incomplete fields. However, once a field has the required data, the validation error should disappear ...

Implementing jQuery during the navigation between Node routes

Below is a snippet of my jQuery code: $(function () { $('.mnav a').click(function () { el = $('.border'); el.addClass('blink'); el.one('webkitAnimationEnd oanimationend msAnimationEnd animatio ...

Activate a click on a div element to enable smooth scrolling when using the page down and page up keys

Whenever I directly click on my div, the pageUp and pageDown keys scroll the contents of the div. But when I trigger a click programmatically, the scrolling with pageUp and pageDown stops working. How can I enable scrolling with pageUp and pageDown without ...

Does anyone have any insights into the technology that powers Twiddla's browsing features?

After some observation, I came to understand that simply inserting <iframe src=remote-page-here></iframe> will not work as expected. Interestingly, the website twiddla does not use flash either. I am intrigued by how they achieve the in-place b ...

Center Vertically Using CSS Flexbox

Hey there, I'm currently facing an issue with aligning my website's logo vertically in the middle with my navigation link list. I have attempted to use "vertical-align: middle" on my div columns but it doesn't seem to be working. Right now, ...

styled-components: the parent's styles take precedence over the child's styles

image export const LogOutButton = styled.button` display: inline-block; .... `; export default styled(ThemedApp)` .... button { .... display: flex; .... } `; Upon inspection, it is evident that the Logout button (with class gBuhXv) ...

Creating a form in PHP with the power of JavaScript, AJAX, and jQuery

I have successfully created a registration form using HTML, processed the data with PHP, and utilized javascript, ajax, and jquery. However, I am facing an issue where I want to display a notification stating whether the operation was "inserted/failed" on ...

"Upload a video file and use JavaScript to extract and save the first frame as an image

I have a webpage where users can upload a video file, and the page will generate a thumbnail based on a timestamp provided by the user. Currently, I am focusing on generating the thumbnail from the FIRST frame of the video. Here is an example of my progr ...

Combining various BEM modifiers in Sass

Currently, I am implementing BEM and have a specific element with multiple modifiers: <div class="block__element block__element--m1 block__element--m2"></div> In my project, SCSS is utilized to write nested rules that are in line with BEM con ...

Placing markers on a straight path

Struggling to create a CSS component where the first and last points don't align properly with the ends of the line. This component should be able to handle any number of points (between 1 and 4) without relying on flexbox. I have a React component ...

Setting the width of a div element dynamically according to its height

Here is a snippet of my HTML code: <div class="persoonal"> <div class="left"></div> <div class="rigth"></div> </div> This is the CSS code I have written: .profile { width: 100%;} .left { width: 50%; float: le ...

Vuelidate is unfalteringly honest and always holds true, even when all conditions are satisfied

After entering a name into the text field, I am unable to proceed to the next card because !this.$v.$invalid never changes to false. I'm not sure what I'm overlooking here. It's worth noting that errors do show up properly when clicking on ...

ReactJs: difficulty in resetting input field to empty string

I have an application using React v 0.13.1 (Old version). I am struggling to update my input field to "" after retrieving the updated value from the database. Scenario: I am updating the input fields by clicking on the button named "Pull&qu ...

Verify the information retrieved from the JSON document

I have a JSON file containing 10 records, and I am continuously adding these records to a list as the page is scrolled. This results in the data being appended dynamically. My goal is to stop appending more data once all the records from the JSON file hav ...