Results 1 to 5 of 5

Thread: Adjusting image size to fit

  1. #1
    Join Date
    Oct 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Adjusting image size to fit

    I want to use an image as a table header background. I have tables of different widths. I want to use the same image for all those images. And how can we make that image to adjust it's width and height such that it fits for every table using CSS (only CSS)?

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    You can't really. Not with a background. But if you don't mind the image being cropped and centered behind smaller headers, and had an image that was at least as big as the largest header, that could be done.

    A sort of pseudo background could probably be setup using relative and absolute positioning, but certain key dimensions would need to be know, it wouldn't just scale itself automatically. Adding or subtracting text would probably throw it off, as could altering font-size in the browser.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Oct 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you for your reply.

    Then, what happens if I create a big (suitable for a large table) image and apply it for all tables? Will it get resized automatically?

  4. #4
    Join Date
    Oct 2005
    Posts
    255
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    I think this might help, try this and see..

    Code:
    <STYLE TYPE="text/css">
    <!--
    .deepsea, .deepsea TD, .deepsea TH
    {
    background-image:url('deepsea.gif');
    background-color:blue;
    color:white;
    font-family:sans-serif;
    font-weight:600;
    }
    -->
    </STYLE>
    Thats the css part now this..

    <TABLE CELLPADDING=8 CELLSPACING=0 CLASS="deepsea">

    I don't know how this will work so try it how...
    Hey new design new look, goto xudas for personal webdsign help.. (:

  5. #5
    Join Date
    Oct 2007
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face It is also not working...

    It is also not working...


    Can I use 3 images at a time as background images for an element?

    That is, first one contains left rounded corners, second one contains center image (will be repeated to fill gap), third one contains right rounded corners.

    (We must not use any other elements and have to use CSS only.)

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
  •