Results 1 to 5 of 5

Thread: background image set as a percent?

  1. #1
    Join Date
    Mar 2007
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default background image set as a percent?

    i have a background that looks like a piece of parchment paper. i want it to take up 90% of the screen regardless of resolution. is there a way to assign a percent to it in the body part of the css file?


    also i have several images on the site. to make them stay the same relative size regardless of resolution is a percentage width the best way to size them up?

    thanks

  2. #2
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    HTML Code:
    <head>
    <style type="text/css">
    <!-- 
    body {
     background: #000000; /*Background of the page behind the image*/
     margin: 0 auto;
     width: 90&#37;;
     text-align: center;
    }
    div#container {
     background: url("host.com/parchment.jpg") no-repeat center;
     z-index: 5; /* Brings this to the top of view */
    }
    // -->
    </style>
    </head>
    <body>
      <div id="container">
           your page
      </div>
    </body>

  3. #3
    Join Date
    Apr 2007
    Location
    Phoenix, AZ
    Posts
    64
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by mdcloud View Post
    also i have several images on the site. to make them stay the same relative size regardless of resolution is a percentage width the best way to size them up?
    That seems like a really difficult thing to calculate and to maintain over your whole site unless you have some sort of script inserting the relative values of your images' widths and heights. But even then you'll have images showing up with really low quality, when they're resized.

    You can make things tile vertically or horizontally to give the illusion of them being resized, but I'd recommend against sizing all of your images relative to the browser window.

  4. #4
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Quote Originally Posted by mdcloud View Post
    also i have several images on the site. to make them stay the same relative size regardless of resolution is a percentage width the best way to size them up?
    you could place min-value's and max-value's on each of them, which would resize them automatically to fit a certain criteria, however as walton said you really shouldn't force a height and width on an image because u need to maintain correct proportions or it will look even worse than if it were to be a different size from the rest

    Code:
    <style type="text/css">
    <!--
    selector img {
     min-width: 00px;
     max-width: 00px;
    }
    // -->
    </script>
    where selector is the tag name of the outter tag wrapping the image tag ...eg <div id="bg_img"><image src .... /> the selector for that would be bg_img

  5. #5
    Join Date
    Jun 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Another question similar to the poster problem.
    I have a background image which I managed to use the slice tool to slice into a few images, and it helps me to put them into a table which would show the full image in html coding. However, the dimesions of the picture is set into pixels and don't really fit nicely into the browser window, is there a way for me to set in the images be to proportional to / a percentage of the browser window, so I get a full-window image all the time? Thanks

Bookmarks

Posting Permissions

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