Results 1 to 5 of 5

Thread: image with special border (without width)

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

    Default image with special border (without width)

    how can i get this kind of border :



    with no border added to img , only with span or div
    I don't know at all image width and I cannot know it (for a photo forum or members galleries with no size limit)

    something like
    Code:
    <div class="bord2">   
    <div class="bord1">      
    <img src="image.jpg" alt="" />   
    </div>
    </div>
    .bord1{
    border:4px solid #ffffff;text-align:center;
    padding:30px;background-color:#dddddd;}
    .bord2{border:2px solid #000000;text-align:center;padding:0px;}


    if you know how to do it ??
    thank you

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

    Default

    What's wrong with what you have there?

    to get rid of the border around the image:

    Code:
    img { border-style:hidden; }

  3. #3
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    CSS:

    Code:
     img { border: 6px solid red; }
    span {
    border: green solid 5px;
    width: auto;
    float: left; }
    HTML Code:
    <span><img src= "main.jpg"></span>
    If you want a third color, add padding and make that third color your page background as it will show through Adjust the border sizes and colors to suit your needs.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

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

    Default

    thank you BLiZZaRD !
    it works fine in that way but I am getting a strange padding-bottom (4 or 5 pixels ?) with safari, opera and firefox, not with IE but who cares for IE ? :-)

    I have to add to the span
    font-size : 0px; and it is great !!

  5. #5
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Glad it works, sorry I left out the span fix, it happens as a result of the auto width attribute for some reason. Good catch.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

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
  •