Results 1 to 6 of 6

Thread: <br /> a:after ?

  1. #1
    Join Date
    Jan 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default <br /> a:after ?

    how can I add a <br /> after each link which are image containers ?

    with
    <a href="#"><img src="" alt="" /></a>

    i want to get
    <a href="#"><img src="" alt="" /><br /></a>

    I have tried with :after but I cannot get it

    thank you for helping

  2. #2
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    set the images to a class

    replace

    Code:
    <a href="#"><img src="" alt="" /></a>
    with

    Code:
    <a href="#"><img src="" alt="" class="img_link" /></a>

    and add the following CSS code to your stylesheet (changing the margin height to your needs):
    Code:
    .img_link { margin-bottom:20px; }

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You can't. :after is not supported by IE. You can do:
    Code:
    a img {
      display: block;
    }
    ... but this will also "add a linebreak" before the image.

    Beware those XHTML-like slashes: they probably don't mean what you think they mean. Read: http://www.webdevout.net/articles/beware-of-xhtml, http://www.hixie.ch/advocacy/xhtml.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Jan 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Medyman View Post
    set the images to a class

    replace

    Code:
    <a href="#"><img src="" alt="" /></a>
    with

    Code:
    <a href="#"><img src="" alt="" class="img_link" /></a>

    and add the following CSS code to your stylesheet (changing the margin height to your needs):
    Code:
    .img_link { margin-bottom:20px; }
    thank you Medyman but that wasn't my question

  5. #5
    Join Date
    Jan 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    You can't. :after is not supported by IE. You can do:
    Code:
    a img {
      display: block;
    }
    ... but this will also "add a linebreak" before the image.

    Beware those XHTML-like slashes: they probably don't mean what you think they mean. Read: http://www.webdevout.net/articles/beware-of-xhtml, http://www.hixie.ch/advocacy/xhtml.
    thanks but I am trying to add a br and no matter if IE cant understand it, it will in its 2008 version

  6. #6
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Does that really matter? People will still be using IE7 and even IE6.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

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
  •