Using div and spans

Discussion in 'HTML & Website Design' started by mosa, Nov 20, 2009.

  1. #1
    I want to keep the image boxes in 1 line. Is the following ok for browsers or can it be used that way.
    And mainly concern about SEO terms.


    #contain {
    height: 100%;
    padding: 5px;

    }
    .test {
    margin: 0;
    float: left;
    border: 0;
    }

    .test2 {
    margin: 0 0 0 8px;
    float: left;
    border: 0;
    }

    <div id="contain">
    <span class="test"> <a href=""><img src=""></a></span>
    <span class="test2"> <a href=""><img src=""></a></span>
    <span class="test2"> <a href=""><img src=""></a></span>
    <br style="clear: both;"/></div>



    Thanks
     
    mosa, Nov 20, 2009 IP
  2. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #2
    Depending on what you're trying to do, images are already inline and you can eliminate the span and most of that css. Just do:
    
    <div>
    <a href=""><img src=""></a>
    <a href=""><img src=""></a>
    <a href=""><img src=""></a>
    </div>
    
    Code (markup):
    And you have inline images with links. Of course, that may not be suitable, as is, for what you want to do and some CSS will still need to be applied.
     
    drhowarddrfine, Nov 20, 2009 IP
  3. vinpkl

    vinpkl Active Member

    Messages:
    899
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    58
    #3
    according to SEO terms, search engine crawlers uses your images "ALT" tags for information.

    it has no concern whether the images are placed in one line or two lines.

    but your html should validate.

    vineet
     
    vinpkl, Nov 20, 2009 IP
  4. mosa

    mosa Active Member

    Messages:
    346
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #4
    In that case how can I set space between two images? Otherwise, all images stick together, aren't they?
     
    mosa, Nov 20, 2009 IP
  5. Masteroa

    Masteroa Peon

    Messages:
    54
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Not sure, but this CSS might work:

    a img {
    margin-left: 5px;
    }
     
    Masteroa, Nov 20, 2009 IP
  6. mosa

    mosa Active Member

    Messages:
    346
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    58
    #6
    I will try that, Thanks
     
    mosa, Nov 20, 2009 IP