Submit Your Article Forum Rules

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Background and image alignment ???

  1. #1
    Senior Member
    Join Date
    Jun 2004
    Posts
    207

    Background and image alignment ???

    Hello Guys.
    I have a problem that has been a pain for me over and over, and I hope that someone can give me advice on how to overcome it.
    Ok, an example.
    I have a table with 3 columns and 1 row.
    Left middle and right

    in left I have an image, leftcorner.gif, in right I have rightimage.gif but as it is expandable and the title text goes in the middle I have the middle image set as background image. When viewed through the browser all three images do not line up correctly.
    Does anyone know how I can overcome this??
    you can see it here www.yeclaserve.com/exchange

  2. #2
    Hi randelld,

    I took a quick look but seeing as all the tables are collapsed, I cannot check it with dreamweaver. I'm sure someone else here will be able to help you soon. A popular answer to this question though, is to make sure all the pictures and tables are aligned the same.

    On another note, you may want to think about importing a css sheet for this site as all the code is currently in your header.

    Good Luck
    | Home Inspectors Directory | Submit your business to our free north american home inspection directory.

  3. #3
    WebProWorld MVP dharrison's Avatar
    Join Date
    May 2005
    Location
    Essex UK
    Posts
    1,334
    Hi randell

    I have gone through your code and you have a few valign attributes in your table coding. Using the Jumila row as an example:

    <td valign=middle background=skins/sunburst/images/cat_top_bg.gif border=0><p align=center><font face='Verdana' size='1' color='#6633cc'>Jumilla</font></p></td>

    I would say remove the valign attributes from the <td></td> tags. It might also be worth declaring an absolute height on the <td></td> tags, for example:

    <td height="30px" background=skins/sunburst/images/cat_top_bg.gif border=0><p align=center><font face='Verdana' size='1' color='#6633cc'>Jumilla</font></p></td>

    HTH
    Deb Harrison
    Essex Web Design | DVH Design Blog
    If I have helped please add to my Reputation

  4. #4
    Senior Member
    Join Date
    Jun 2004
    Posts
    207
    Thanks guys.
    The script is a mixture of php and html. This makes it more difficult for me to understand. However, I'll go through it tomorrow and see if I can apply what you've suggested.

    Thanks again.

  5. #5
    Step 1: Convert site to CSS/XHTML

    Step 2: Come back and ask again. :)
    100% XHTML Compliant Since 2004

  6. #6
    Senior Member craigmn3's Avatar
    Join Date
    Jan 2004
    Posts
    476

    hey

    I did a quick copy and paste, and your images are huge, and you have resized them. Perhaps if you resize them, then post you might have more luck

  7. #7
    Senior Member DrTandem1's Avatar
    Join Date
    Oct 2003
    Posts
    1,828
    There are a lot of problems with the page given. Clean up the HTML errors. Lots of open tags, misplaced tags, incorrect nestings, etc. I noticed you have a height attribute for the table tag. There is no height attribute for a table, only width.

    Adding padding to the cells will cause problems, if it is not uniformly done.

    Now, onto your main question regarding the alignment. I believe the issue here is caused by the font size expanding the height of the table cell. In other words, your font height is exceeding the image's height. You are using font tags and with all the CSS stuff you have, I don't know why.

    Speaking of the CSS, move it all into an external style sheet. Do the same with the JavaScript. Then straighten out the head section.

    After that, gives us another look.
    DrTandem's San Diego Web Page Design, drtandem.com

  8. #8
    Senior Member DrTandem1's Avatar
    Join Date
    Oct 2003
    Posts
    1,828
    Also, the background image dimensions does not match the corner images dimensions:

    http://www.yeclaserve.com/exchange/s...cat_top_bg.gif

    http://www.yeclaserve.com/exchange/s...t_top_left.gif

    While both images appear to have a height of 14 pixels, if you look at the properties of cat_top_left.gif on the page itself you see this:

    Dimensions: 132 x 15

    From where is this extra pixel coming? I believe it is caused by the fact that you neglected to enter the image's height dimension in the image tag and the image is expanding to fit the cell. Try adding height="14" and see how it looks. I think the cell is expanding to meet the taller cell in the middle. It is taller due to the font. Don't forget to set the valign="top" for the cells.
    DrTandem's San Diego Web Page Design, drtandem.com

  9. #9

    Photoshop & All Background Imgs

    If you're using Adobe Photoshop and have ImageReady, try bringing in your "image bar" there and use the slice tool to divide it into the three parts. Then, save the image slices and HTML code (using the Output Settings, let ImageReady make the table). Also, when you make the slices, try making the two ends cut short (such as only as big as the rounded edge) and leave the center image most of the length. I'm just thinking that so if it misaligns again, it'll only be a tiny bit on the ends.

    When you get the HTML page with the table formatted, try switching ALL the images to backgrounds and make the middle cell fluid so it will expand & contract as the browser window moves (which I'm sure you already know how to do.) I've always had images align properly when I leave the ImageReady exported code alone (for the most part.)

    Maybe that might help. :)
    ~Mark G.
    Graphic Designer - Endoscopy Support Services, Inc.

  10. #10
    Senior Member
    Join Date
    Aug 2003
    Posts
    294
    Something to ponder...

    <style type="text/css">
    .titleback {background: url('http://www.yeclaserve.com/exchange/skins/sunburst/images/cat_top_bg.gif'); padding:0; margin:0; height:14px; text-align:center; line-height:14px; font-family:verdana; font-size:10px; color:#6633cc; font-weight:bold;}
    .titleleft {background: url('http://www.yeclaserve.com/exchange/skins/sunburst/images/cat_top_left.gif'); padding:0; margin:0; width:127px; height:14px;}
    .titleright {background: url('http://www.yeclaserve.com/exchange/skins/sunburst/images/cat_top_right.gif'); padding:0; margin:0; width:127px; height:14px;}
    </style>
    </head>
    <body>
    <table cellspacing="0" cellpadding="0" width="98%" align="center">
    <tr><td class="titleleft"></td>
    <td height="14px" class="titleback">Welcome</td>
    <td class="titleright"></td>
    </tr></table>
    Hello everyone! Newbie. Self-taught. Loves writing web-code.

Page 1 of 2 12 LastLast

Similar Threads

  1. Background image: How to?
    By kgun in forum Graphics & Design Discussion Forum
    Replies: 9
    Last Post: 10-24-2009, 01:58 PM
  2. Background Image Problem
    By chingy in forum Graphics & Design Discussion Forum
    Replies: 5
    Last Post: 01-23-2006, 02:20 AM
  3. Using a background image
    By michaelstevenson in forum Graphics & Design Discussion Forum
    Replies: 2
    Last Post: 01-21-2005, 08:26 AM
  4. Background image repeating
    By volastyle in forum Graphics & Design Discussion Forum
    Replies: 3
    Last Post: 01-05-2005, 01:30 PM
  5. CSS background image
    By emi_b in forum Graphics & Design Discussion Forum
    Replies: 9
    Last Post: 05-18-2004, 11:17 AM

Posting Permissions

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