...

View Full Version : css background



esthera
11-02-2006, 10:46 AM
in the code below for some reason the background images are not coming up at all and they are saved in the same folder as this html file. did i do something wrong?

Also will the page break css actually make it print into pages when the site is printed.



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.NewPage {page-break-after: always;}
.pageone{
background-image: url(2.jpg);
width:595px;
height:842px;

}

.2{
width:595;
height:842;
background-image: url(3.jpg);
}
</style>
</head>

<body>
<div class=pageone>dfdf</div>
<div class=newpage></div>
<div class=2>dfdsf</div>
</body>
</html>

_Aerospace_Eng_
11-02-2006, 12:50 PM
Class names or IDs cannot begin with a number. You are using a partial doctype which puts IE into quirks mode. Learn to use full doctypes. Also when using a full doctype CSS is case-sensitive when it comes to calling IDs or classes. You also need to use units in CSS for things to work properly. Try this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.newpage {
page-break-after:always;
}
.pageone {
background:url(2.jpg);
width:595px;
height:842px;
}
.box2{
background:url(3.jpg);
}
</style>
</head>

<body>
<div class="pageone">dfdf</div>
<div class="newpage">&nbsp;</div>
<div class="pageone box2">dfdsf</div>
</body>
</html>
If that doesn't work make sure you have your file names right, again these are also case-sensitive.

alphomega
11-02-2006, 02:09 PM
.2{
width:595;
height:842;
background-image: url(3.jpg);
}



I would also suggest setting a measurement value for your width and height ie %,px,em etc

_Aerospace_Eng_
11-02-2006, 02:10 PM
I would also suggest setting a measurement value for your width and height ie %,px,em etc

I already said that

Class names or IDs cannot begin with a number. You are using a partial doctype which puts IE into quirks mode. Learn to use full doctypes. Also when using a full doctype CSS is case-sensitive when it comes to calling IDs or classes. You also need to use units in CSS for things to work properly.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum