http://www.webmasterworld.com Welcome to WebmasterWorld Guest from 38.103.63.17
register, login, search, glossary, subscribe, help, library, PubCon, announcements , recent posts, unanswered posts
Subscribe to WebmasterWorld
Home / Forums Index / Browser Side World / CSS
Forum Library : Charter : Moderators: DrDoc & Robin reala & SuzyUK

CSS

  
div background image not showing
dexxa


#:3608233
 11:55 pm on Mar. 22, 2008 (utc 0)

hello. so i have this website. i am trying to set a background image for a div. but the image is not showing.
however if i take out
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
from the html page. it works in ie but not in firefox. can someone please help? thank you

css:

#main
{
position: absolute;
left: 0px;
top: 0px;
width: 102%;
height: 799px;
background-color: transparent;
background-image: url(images/bodybg.jpg);
background-attachment: fixed;
background-repeat:repeat-x;
}
#logo
{
position:absolute;
top:0px;
left:0px;
width:344px;
height:144px;
}
#headerright
{
position:absolute;
top:0px;
left:344px;
height:144px;
width:460px;
background-image:url('images\headerright.jpg');
background-repeat:no-repeat;

}
#header
{
position:relative;
height: 144px;
width:800px;
}

html:


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Nanirx_main</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="main.css" rel="stylesheet" type="text/css" />
<style type="text/css">
#Button1
{
height: 141px;
width: 451px;
}
</style>
</head>
<body>
<center>
<div id="main">
<div id="header">
<div id="logo">
<img alt="" src="images\logo.jpg" />
</div>
<div id="headerright">

</div>
</div>
</div>
</center>
</body>
</html>


Xapti


#:3608661
 6:11 pm on Mar. 23, 2008 (utc 0)

Make sure your image URIs are right. For instance, some of them seem to be using a backslash instead of a forward slash.

[edited by: Xapti at 6:12 pm (utc) on Mar. 23, 2008]

dexxa


#:3608717
 7:44 pm on Mar. 23, 2008 (utc 0)

thanks for replying. dont think the urls are the problems though. they dont show in IE if i keep <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> in the html file. once i remove it, the pictures appear. pretty sure i am breaking some xhtml standard.

dexxa


#:3608811
 1:13 am on Mar. 24, 2008 (utc 0)

ok it was the slashes. ie takes both slashes but not firefox. i feel stupid now.

 

Home / Forums Index / Browser Side World / CSS
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
WebmasterWorld ® and PubCon ® are a Registered Trademarks of WebmasterWorld Inc.
© WebmasterWorld Inc. / SearchEngineWorld 1996-2008 all rights reserved