Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: css background

  1. #1
    Senior Coder
    Join Date
    May 2004
    Posts
    1,464
    Thanks
    15
    Thanked 0 Times in 0 Posts

    css background

    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.

    Code:
    <!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>

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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
    Code:
    <!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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Oct 2006
    Location
    Southampton
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by esthera View Post


    .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

  • #4
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Quote Originally Posted by alphomega View Post
    I would also suggest setting a measurement value for your width and height ie %,px,em etc
    I already said that
    Quote Originally Posted by me
    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.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •