Results 1 to 6 of 6

Thread: Border="0" html4 strict / alternatives for no border img

  1. #1
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Border="0" html4 strict / alternatives for no border img

    Been trying to figure this one out.

    Is there a substitute code when using html4 strict for a border="0" img that will validate.

    <a href="http://www.duralitebatteries.com"><img src="image_themes/duralite.gif" alt="Duralite Batteries" border"0" />

    Thanks

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    You have to use CSS for this. An example would be:

    Code:
    img {
    border: 0px;
    }
    That will take any border of all images. If you only wanted to do this with those images that are linked, then do something like this in the css:

    Code:
    .linked-img {
    border: 0px;
    }
    Then on every image that is linked, place this:

    Code:
    <img src="test.gif" class="linked-img" alt="Alt Text">
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by thetestingsite View Post
    If you only wanted to do this with those images that are linked, then do something like this in the css:

    Code:
    .linked-img {
    border: 0px;
    }
    Then on every image that is linked, place this:

    Code:
    <img src="test.gif" class="linked-img" alt="Alt Text">
    Using context would be far more sensible:

    Code:
    a:link img {
        border: none;
    }
    HTML Code:
    <!-- Nothing special about the img element: -->
    <a href="..."><img alt="..." src="..."></a>
    Mike

  4. #4
    Join Date
    Jul 2006
    Posts
    113
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks that did the trick..

    G.

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

    Default

    Although others have corrected this in their examples, nobody mentioned it: the / at the end of your <img> tag in your original example is invalid HTML without SHORTTAGS.
    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!

  6. #6
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey View Post
    Although others have corrected this in their examples, nobody mentioned it: the / at the end of your <img> tag in your original example is invalid HTML without SHORTTAGS.
    The SGML declaration for HTML enables the SHORTTAG feature. The only invalid part of the OP's post is the missing equals symbol (=) between the attribute name and value, however, ignoring that, the snippet doesn't technically result in the parse tree that the OP intended.
    Mike

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
  •