Results 1 to 10 of 10

Thread: White space between elements

  1. #1
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default White space between elements

    Hi everyone,

    Here is my problem

    Code:
        <div id="header">
              <img src="images/header_top.jpg" alt=" " />
    	<img src="images/header_bottom.jpg" alt=" "  />
        </div>
    this will generate a white space (~2px), between the two pic in every browser.

    Code:
    <div id="header"><img src="images/header_top.jpg" alt=" " /><img src="images/header_bottom.jpg" alt=" "  /></div>
    this one will not generate a white space ??
    The only difference is that in the first after the first img i press "enter" and "tab" so i can make my code more readable.
    I tried with just "enter" without the indent .... same white space between the pics!

    My editor is DreamWeaver CS3.

    #header margin and padding are 0
    #header img margin and padding are 0 too

    Pls how to fix it? I cant type all my code on one line

    Tnx iin advance
    Last edited by bokosr; 02-06-2008 at 03:50 PM.

  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

    It isn't clear to me whether you are talking about horizontal or vertical space.

    The image tag by default is an inline element. As such, it is a lot like typing out text. Any one white-space character between characters (tags in this case) is interpreted as a space, all others are ignored.

    Additionally, in a standards compliant browser under strict mode, all images with their default display of inline reserve a small bit of layout space at the bottom. This is because all inline elements are expected to fit the 'contains text' model of a span tag, where space is reserved for the tails on letters like g, q, j, etc.

    You don't have to type all of your code on one line, but for images that touch horizontally, you can break the line within the tag:

    Code:
        <div id="header">
              <img src="images/header_top.jpg" alt=" "
    	 /><img src="images/header_bottom.jpg" alt=" "  />
        </div>
    or use style (for side by side images one possible method is):

    Code:
    #header img {
    display:block;
    float:left;
    }
    #header div {
    clear:left;
    }
    Code:
        <div id="header">
              <img src="images/header_top.jpg" alt=" " />
    	<img src="images/header_bottom.jpg" alt=" " />
            <div></div>
        </div>
    for images that are one above the other touching vertically (as is implied by their names):

    Code:
    #header img {
    display:block;
    }
    Code:
        <div id="header">
              <img src="images/header_top.jpg" alt=" " />
    	<img src="images/header_bottom.jpg" alt=" "  />
        </div>
    - John
    ________________________

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

  3. #3
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok, will try it now.
    If it doesnt work i will post a link to the page and a screen print with my problem.

    Tnx

  4. #4
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That fix my problem. But still i whould like to know what a more experienced users think about the code.


    http://brfk.org/work/index.html
    http://brfk.org/work/styles.css

  5. #5
    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

    Both your style and markup pass the respective W3c validators. The look of the page varies slightly between FF and IE 7, but that doesn't appear to be problematic - no gaping spaces or loss of content.

    The source code is organized and neatly written.

    I cannot read the language, so cannot comment upon the functional clarity of the links or of the content.

    The images are pleasant looking and evoke a feeling of 'something organized and good for dogs' to me, and probably most people will get that.
    Last edited by jscheuer1; 02-06-2008 at 06:13 PM. Reason: spelling
    - John
    ________________________

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

  6. #6
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    10x a lot for the comment. I have some more work to finish it. Will repost again when done.
    About the language its bulgarian and the site is about a dog organization.

    Good Luck to all.
    Tnx again to jscheuer1
    Last edited by bokosr; 02-06-2008 at 08:22 PM.

  7. #7
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Its done, at least no big changes are expected.

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

    Default

    I am sure this is just a harmless typo, but organisation is supposed to be with a Z, not a s

  9. #9
    Join Date
    Feb 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    its not ... low english skils :>

  10. #10
    Join Date
    Apr 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well thanks a lot for this, it helped me solve a problem I had as well.

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
  •