Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Mar 2011
    Posts
    164
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Is this best way to place images side by side?

    Is this the best way to align images to that they are aligned side by side, i.e. horizontal?

    Code:
    <div style="width:410px; height:105px; border:1px solid red; padding:5px;">
    
    <img alt="this is image #1" src="#" style="width:100px; height:100px; border:1px solid blue; float:left;" />
    <img alt="this is image #2" src="#" style="width:100px; height:100px; border:1px solid blue; float:left;" />
    <img alt="this is image #3" src="#" style="width:100px; height:100px; border:1px solid blue; float:left;" />
    <img alt="this is image #4" src="#" style="width:100px; height:100px; border:1px solid blue; float:left;" />
    
    </div>
    it seems to work ok but i just wanted to be sure thanks
    Last edited by listerdl; 03-05-2012 at 04:11 PM. Reason: update

  • #2
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,224
    Thanks
    10
    Thanked 269 Times in 268 Posts
    Sure, it seems fine. I would make a CSS class for the image style, so you don't need to repeat it every time and so you can change them all if you decide you don't want a blue border or some such.

    Dave


  •  

    Posting Permissions

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