logo elektroda
logo elektroda
X
logo elektroda

CSS Fix for Inline Images Showing Gaps in XHTML Strict Doc

zbika73 28617 7
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • #1 6881415
    zbika73
    Level 2  
    Hello,
    I have a little problem with displaying images side by side.
    A simple example:

    
      
        
           
           
    
           
        
      
    


    The first two images are displayed side by side, BUT with a small space between them (the newline character is converted to a space).
    The second two pictures are displayed next to each other without any break - the effect I want.

    Unfortunately, I have a generated page, so I can't put all tags on one line.

    How can I make the first two images also display without any interruption?

    Setting CSS attributes (width, height - I set)
    
    	img { padding: 0; margin: 0; hspace: 0; vspace: 0; }
    

    did not work :(

    DOCTYPE I have XHTML Strict but Transitional displays the same.

    Thanks for the help,
    Zbyszek
  • ADVERTISEMENT
  • #2 6882055
    KSRhaziel
    Level 36  
    Try adding border=0 attribute (not CSS).

    zbika73 wrote:
    Unfortunately, I have a generated page, so I can't put all tags on one line.
    In HTML, spaces (between tags), lines or tabs don't matter. You might as well write everything on one line, or with line spacing every letter - the effect in the browser should be the same. Are you sure that the inserted image doesn't accidentally have a few empty vertical lines on one of the sides, which gives the impression of being spread out?
  • ADVERTISEMENT
  • #3 6882157
    sharic11
    Level 13  
    how it will be displayed depends on the size of the images
  • #4 6882400
    Dżyszla
    Level 42  
    Unfortunately, it is rather impossible to get around the problem of not separating images that are separated by enter or tab in the codes. You can try to set the right margin to negative (margin-right: -2px}, but this may produce unexpected results and will not take into account the size of the "active" font.
  • ADVERTISEMENT
  • #5 6882729
    one_eddie
    Level 25  
    Zbika73: Don't you sometimes mean something similar to the one below?

    
        
    
    
    
           
    
    
           
    
    
           
    
    
           
    
    
        
      


    You can also fight with "div style="float:left..." instead of table.
  • ADVERTISEMENT
  • #6 6905232
    ixar
    Level 15  
    Or try giving:

    style="font-size:0pt;"

    ;)
  • #7 6907595
    zbika73
    Level 2  
    Thank you for your comments.

    I had to put the code with the images on a single line. This required changing the generator, but project colleagues accommodated my need.
    Everything looks as it should.

    Attempts to work around (div, style change, inserting a table) did not bring the expected results, so it was easier to focus on changing the generating code.
  • #8 6907749
    piotrkopec
    Level 17  
    A very important thread. Browsers like IE and FF have come a long way in development and still don't fully implement their "tagging". On the other hand, using code without whitespace between elements reduces the share of spaces in network traffic. Just let's try to edit a 30K file in one line, eg in such a cool editor as "vim". The processor sweats like gluing divx.
    A good lesson for everyone who doesn't know all the secrets of html. Well, congratulations on the solution. Found by the way link

Topic summary

The discussion revolves around a user's issue with displaying inline images side by side in an XHTML Strict document, where newline characters create unwanted gaps between the images. Various solutions are proposed, including using the `border=0` attribute, adjusting image sizes, and setting negative margins. However, the most effective solution was to modify the code generator to place the image tags on a single line, which resolved the spacing issue. The conversation highlights the challenges of whitespace in HTML and the importance of code structure for proper rendering across different browsers.
Summary generated by the language model.
ADVERTISEMENT