Background image not visible on Firefox and Chrome when using a DIV element

I'm encountering an odd issue where my DIV background isn't showing up in Firefox and Chrome, but it looks fine in IE. I've searched on several places like Stackoverflow for solutions to this problem, but none of them have worked for me so far.

There was a suggestion in a forum that it could be related to browser caching or the fact that I'm using Windows XP. I don't think browser caching is the culprit here since I've been testing my page offline, and even when I tested online right after uploading the files, the issue persisted. I haven't had the chance to try it out on a different Windows platform like Vista, but ideally, I want my background image to display consistently across all platforms.

Below are my CSS and source code:

CSS

body {
margin: 0px;
background:url(../images/bground.jpg) fixed bottom;
}

.area {
width:738px;
margin:0 auto;
padding:0 131px;
}

#menu {
width:738px;
height:41px;
position:absolute;
top:273px;
text-align: left;
}

#navlist li {
display: inline;
list-style-type: none;
padding: 0 20px 0 0;
}

#sec-menu {
height:41px;
position:absolute;
right:131px;
top:50px;
text-align: right;
border-bottom:1px solid #bbb
}

#sec-navlist li {
display: inline;
list-style-type: none;
padding: 0 0 0 10px;
}

#register {
position:absolute;
right:131px;
top: 110px;
}

#content {
width:1000px;
position:absolute;
top:273px;
text-align: center;

}

Source Code

<body onload="MM_preloadImages('images/register-over.png')">

<div class="area" style="height:343px; background:transparent url('images/header.png') top no-repeat center; position:relative">

<div id="sec-menu">
<ul id="sec-navlist">
    <li><a href="#" class="sec-menu">International Faculty</a></li>
    <li><a href="#" class="sec-menu">Contact</a></li>
    <li><a href="#" class="sec-menu">Sitemap</a></li>
</ul>
    </div>

<a href="#"><img src="images/register.png" alt="Register for KLVS 2011 Now!" width="91" height="89" id="register" onmouseover="MM_swapImage('register','','images/register-over.png',1)" onmouseout="MM_swapImgRestore()" /></a>

<div id="menu">
    <ul id="navlist">
    <li class="menu-active">Home</li>
    <li><a href="#" class="menu">About KLVS 2011</a></li>
    <li><a href="#" class="menu">Programmes</a></li>
    <li><a href="#" class="menu">Accommodation</a></li>
    <li><a href="#" class="menu">Exhibitors &amp; Sponsors</a></li>
    <li><a href="#" class="menu">Call for Abstract</a></li>
</ul>
</div>

<div class="area" style="background:url(images/transparent-white_12.png) repeat-y"><br />
</div>

The Issue

The 'header.png' image isn't appearing in the first DIV that uses the area class. Another important detail to note is that I apply the same area class to another DIV with a different background image, and that one displays correctly on IE, Firefox, and Chrome. I've attempted to remove position:relative and/or transparent from the first DIV, but the problem persists.

I've validated my file on http://validator.w3.org/ and it passed, so I'm really puzzled about what could be causing this. I hope someone on Stackoverflow can assist me with resolving this.

Thank you.

Answer №1

There seems to be an error in your CSS code. Using shorthand for the styles top and center has caused confusion. To resolve this, combine these styles together:

<div class="area" style="height:343px; background:transparent url('images/header.png') top center no-repeat ; position:relative">

top center no-repeat

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

Creating dynamic form fields using AngularJS

I have a form that includes an input field, a checkbox, and two buttons - one for adding a new field and one for deleting a field. I want to remove the add button and instead show the next field when the checkbox is checked. How can I achieve this? angu ...

looking to change the background color of a CSS element

Here is a CSS code snippet that I am struggling with: .select, .input, .schedule, .editableFields { cursor: pointer; background-color: blue; } However, the above code overrides this one: #past .layer.color { background-color: #E5D403 !import ...

Jquery Droppable issue arising with dynamically added DIVs

I am facing a similar issue as described in this question and this one I am trying to implement drag-and-drop and resize functionality. It is working fine for static elements, but I encounter issues when adding dynamic divs. The resize property works prop ...

CSS animations are only functional when the Developer Tools are activated

I recently implemented a transition to uppercase in CSS, but it seems to only work when I open dev tools in Mozilla and not at all in Chrome. This is my first attempt at using animations in CSS, so any feedback on my code is appreciated. I'm curious ...

Centering Vertical Tabs Using HTML and CSS

I followed a vertical tab tutorial on W3Schools and would like to implement it on my website. However, I am having trouble centering the tabs after reducing their width sizes. I have attempted adding div tags to the code and aligning them to the center wit ...

Adding a simulated bottom border to a rotated container

Currently, I am utilizing the CSS3 rotate value to create an arrowhead effect for modal boxes. However, I now require a full arrowhead design with a bottom border. As this involves rotating a div at a 45° angle, adding another border to either side will n ...

What is the method for adjusting the font size of the label in an Angular mat-checkbox element?

I've been trying to adjust the font size of a mat-checkbox's label, but no matter what I do, the component's default styles keep overriding my changes: Using !important Trying ::ng-deep Applying a global style in styles.scss <mat-checkb ...

What is the best method for applying classes to a collection of DOM elements with jQuery?

I attempted two different methods of iterating through the arrays, but encountered the same error: addClass is not function First attempt using a for loop: function game(){ var cards = $('.card'); function initialize(){ for ...

Is that possible to prevent the use of the & symbol in Angular 4 HTTP requests?

Using an HTTP request to save data in my database. The code snippet I used is: const form = '&inputdata=' + myinput + '&rf_date=' + rf_date; return this.http.post(this.rootUrl, form, {headers : this.reqHeader}); In thi ...

Optimize Your Website for Various Screen Sizes

Can anyone assist with centering my webpage on small screen sizes? Everything looks good at the normal width of 989px, but once it shrinks, it shifts to the left and leaves excess white space on the right. I've tried various methods to correct this is ...

Prevent css from reverting to its original rotation position

I attempted to style the navigation list with the following CSS: #navlist:hover #left-arrow { border-top: 10px solid white; position: relative; transform: translateX(120.2px) rotate(180deg); } Would it be better to use jQuery for the rotation ...

Tips for hiding the overflow scrollbar on Microsoft Chrome when there is no content to scroll

Looking for a solution to hide scroll bars in Microsoft Chrome, but only when there is no content to scroll? The current div and styles always show the horizontal and vertical scroll bars, even when the height exceeds the content. <div style="backgroun ...

Harvest information using BeautifulSoup and Python

Exploring the world of web scraping with BeautifulSoup in Python, I am interested in extracting the package name and price of each app from the Android Play Store. For retrieving the package name, I implemented the following code : url = "https://play.go ...

When an li element is styled with a width of 50% and floated to the left, it does not display the bullet points

When attempting to create a 2-column list, I implemented the following CSS: ul { overflow: hidden; } ul li { float: left; width: 50%; } However, I noticed that when I have 2 items in the list, the one on the right displays a list bullet while th ...

Adjust the button's color even after it has been clicked

My goal is to update the button's color when it's clicked. I found some examples that helped me achieve this, but there's an issue - once I click anywhere outside of the button, the CSS class is removed. These buttons are part of a form, and ...

Divs sliding out of alignment

I am experiencing an issue with the scrolling behavior of a wrapper div that contains two nested divs. Specifically, when I scroll the wrapper horizontally on Android devices, the header section and content section seem to be out of sync and there is a not ...

Why do the back button and custom scroller behave differently on two different webpages?

I’ve added the malihu custom scroller to my website, but it’s behaving differently compared to how it works in the demo. I can’t seem to figure out what's causing this discrepancy. For reference: Demo: check here Website: visit here The fo ...

developing a loading animation with progress indicator in CSS3

I have been working on creating a preloader, but I am having trouble embedding the percentage with the CSS circle. So far, I have tried various plugins without success. Can anyone help me with this issue? Here is my current progress. Below is the HTML co ...

Footnote fiascos

I am currently in the process of creating a footer for my webpage and have implemented the following CSS styling: #footer { height: 100px; background-color: #F3F3F3; position: absolute; bottom: 0; } Although the footer is displaying at th ...

The content within a div block is having trouble aligning vertically

I need help with centering the content inside my fixed-top navigation bar vertically. I am using bootstrap to design my page, and the navigation bar consists of an image as the nav header and a container with links. The container surrounding these element ...