Results 1 to 3 of 3

Thread: question about background image

  1. #1
    Member sudhakararaog's Avatar
    Join Date
    Sep 2009
    Posts
    224

    Default question about background image 11 Oct 2009 @ 09.43

    question about background image

    i am using 3 divs which contains a background image in each of the 3 divs name top btm and ctr

    my question is about the ctr div, the background image i have used has a width of 235px and height of 125px, if the content will be small and can fit within 125px then there is no issue, however the amount of content that i need in the ctr div is beyond 125px

    as you will notice from the link i have given to the page below for this example, if i use a background color closer to the background image then a clear gap appears in the ctr div where the content is, also the background image of the ctr div has a small white color on left and right side so if i use a background color as the content is more than 125px that white color disappears and the look of the center div is not what i want


    so should i simply use a solid background color for the entire ctr div

    please advice.

    thanks.

    this example with the 3 images is available at
    Untitled Document


    following is the code

    HTML Code:
    <div class="bgtop"></div>
    
    <div class="bgctr">
    <p>Lorem ipsum dolor sit amet, consetetur sadi pscing sed diam</p>
    <p>Erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea  rebum. Lorem ipsum dolor sit amet, consetetur sadi pscing elitr, sed diam </p>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean ut lectus eu enim dapibus placerat. Aenean cursus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Fusce wisi mi, auctor et, tincidunt in, fermentum sed, mauris. Ves</p>
    </div>
    
    <div class="bgbtm"></div>
    Code:
    .bgtop{
    float: left;
    width: 235px;
    height: 10px;
    background: url(topbg.jpg) no-repeat;
    }
    
    .bgctr{
    float: left;
    width: 215px;
    height: auto;
    background: #dedede url(ctrbg.jpg) repeat-x;
    padding: 0 10px 0 10px;
    }
    
    .bgbtm{
    float: left;
    width: 235px;
    height: 10px;
    background: url(btmbg.jpg);
    }
    Last edited by CloudedVision; 11 Oct 2009 at @ 19.50. Reason: Use [code] and [html] tags please.
      Reply With Quote

  2. #2
    Senior Member stu2000's Avatar
    Join Date
    Jan 2009
    Posts
    566

    Default 11 Oct 2009 @ 16.09

    Hi sudhakararaog,

    As you said, if you use the solid colour for the background, then you'd lose some of the effect that you are after with the white line down the left. Could you make the ctr .jpg file longer? Or is it possible that the content is going to be really really long, which would mean a very very large jpg file for the background?
    Last edited by stu2000; 11 Oct 2009 at @ 16.32. Reason: typos
      Reply With Quote

  3. #3
    Super Moderator CloudedVision's Avatar
    Join Date
    Jan 2009
    Posts
    831
    Blog Entries
    4

    Default 11 Oct 2009 @ 19.49

    Hmmm.... This would be a nice place for multiple background images. Too bad CSS3 isn't supported in most browsers yet.

    But I'm sure with some fancy HTML/CSS2 you can make it work out. Have something like this:

    HTML Code:
    <div class="bgctr">
    <div class="bgctr2">
    <p>Lorem ipsum dolor sit amet, consetetur sadi pscing sed diam</p>
    <p>Erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Lorem ipsum dolor sit amet, consetetur sadi pscing elitr, sed diam </p>
    <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean ut lectus eu enim dapibus placerat. Aenean cursus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Fusce wisi mi, auctor et, tincidunt in, fermentum sed, mauris. Ves</p>
    </div>
    </div>
    Code:
    .bgctr{
    float: left;
    width: 215px;
    height: auto;
    background:url('repeating-1px-high-image.jpg') repeat-y;
    }
    
    .bgctr2 {
     background: url('ctrbg.jpg') no-repeat;
     padding: 0 10px 0 10px;
    }
    That might work out.

    PS: Use GIF or PNG-8 images instead of JPGs for the simple images you have. You'll get better compression and better quality. JPGs are best for photographs.
      Reply With Quote

Similar Threads

  1. background image
    By sudhakararaog in forum HTML & CSS
    Replies: 3
    Last Post: 25 Aug 2010, @ 01.55
  2. background image for list
    By sudhakararaog in forum HTML & CSS
    Replies: 3
    Last Post: 2 Jul 2010, @ 16.48
  3. on hover background image
    By sudhakararaog in forum HTML & CSS
    Replies: 4
    Last Post: 3 Mar 2010, @ 17.40
  4. Background image positioning
    By Michael in forum HTML & CSS
    Replies: 0
    Last Post: 26 Jan 2010, @ 20.30
  5. background image issues
    By saltedm8 in forum HTML & CSS
    Replies: 1
    Last Post: 29 Jul 2009, @ 12.58

Tags for this Thread

Posting Permissions

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