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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Simple page with image

    Hi

    I want to create a simple page with background image and a image on the center of the page. Screenshot

    Code:
    <!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>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    body {
    	background-color: #CCC;
    	background-image: url(bg.png);
    	vertical-align: middle;
    	background-repeat: repeat-x;
    	height: auto;
    
    }
    
    .container {
    	vertical-align: middle;
    }
    
    
    </style>
    </head>
    
    <body>
    <div class="container">
    <div align="center"><img src="image.png" align="middle" style="padding-top:30px; padding-bottom:30px;  verticle-align: middle; vertical-align: middle;" /></div>
    </div>
    </body>
    </html>
    Please help me creating this webpage. From the above code i get this result Screenshot
    Attached Thumbnails Attached Thumbnails Simple page with image-demo45.png   Simple page with image-bg.png   Simple page with image-demo50.png  

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,776
    Thanks
    41
    Thanked 196 Times in 195 Posts
    try taking a 1 px slice of that purple/black "image" and then try doing
    Code:
    background:url('pathofslice') repeat-x;
    background:url('pathofimage') no-repeat center center;
    idk if it'll work, first thought*

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #3
    New to the CF scene
    Join Date
    Aug 2010
    Posts
    8
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I have changed the above code and using table code
    Code:
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    So now the image appeared at the center. don't know how to take slice so now using a different background
    Last edited by jseek; 07-21-2011 at 02:39 PM.


  •  

    Posting Permissions

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