CSS problem - what am i doing wrong?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Mutt
    Too lazy to set a custom title
    • Sep 2002
    • 34431

    #1

    CSS problem - what am i doing wrong?

    I'm trying to put a single pixel border around thumbnails with some padding between the thumbnail and border - and on hover the border will change color.

    so i did this

    a.blah:link
    {border: 1px solid #000;
    padding: 4px;
    }

    a.blah:hover
    {border: 1px solid #FFF;
    padding: 4px;
    }

    and......

    <a href="file.wmv" class="blah"><img src="thumbnail.jpg" border="0"></a>

    what the result is - there's a single border with the 4px padding but the border doesn't surround the entire thumbnail, it's only like 10 pixels in height.

    I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!
  • TheDoc
    Too lazy to set a custom title
    • Jul 2001
    • 13827

    #2
    May be some hack in way to do it... but easiest way across all browsers would be to wrap the picture in a div, which has your pad and border, then hover that div.

    set a width/height on the a in css to fix the height issue..
    Last edited by TheDoc; 11-27-2010, 04:04 PM.
    ~TheDoc - ICQ7765825
    It's all disambiguation

    Comment

    • Kiopa_Matt
      Confirmed User
      • Oct 2007
      • 1448

      #3
      I'm no designer, so there's a chance this won't work, but try changing your HTML to:

      <span class="blah"><a href="file.wmv"><img ... ></span>

      Then in your CSS, add in the attribute "display: block;"

      Don't scold me if that doesn't work though.
      xMarkPro -- Ultimate Blog Network Management
      Streamline your marketing operations. Centralize management of domains, pages, Wordpress blogs, sponsors, link codes, media items, sales and traffic statistics, plus more!

      Comment

      • Tempest
        Too lazy to set a custom title
        • May 2004
        • 10217

        #4
        yeah.. thumbs etc. are a freakin pain in the ass for hovers etc. Maybe try this.. Note you need to set the width and height.

        Code:
        a.blah:link,a.blah:hover,a.blah:active{
        	width:XXpx;
        	height:XXpx;
        	border:1px solid #00f;
        	text-decoration:none;
        	padding:4px;
        	display:block;
        }
        
        a.blah:hover{
        	border:1px solid #f00;
        }

        Comment

        • Mutt
          Too lazy to set a custom title
          • Sep 2002
          • 34431

          #5
          Originally posted by Tempest
          yeah.. thumbs etc. are a freakin pain in the ass for hovers etc. Maybe try this.. Note you need to set the width and height.

          Code:
          a.blah:link,a.blah:hover,a.blah:active{
          	width:XXpx;
          	height:XXpx;
          	border:1px solid #00f;
          	text-decoration:none;
          	padding:4px;
          	display:block;
          }
          
          a.blah:hover{
          	border:1px solid #f00;
          }

          thanks - display: block solved it - when i added height and width it messed up the padding - the top and side paddings were the same but the bottom padding was larger.

          thanks for the other suggestions, they probably work too.
          I moved my sites to Vacares Hosting. I've saved money, my hair is thicker, lost some weight too! Thanks Sly!

          Comment

          • Tempest
            Too lazy to set a custom title
            • May 2004
            • 10217

            #6
            Originally posted by Mutt
            thanks - display: block solved it - when i added height and width it messed up the padding - the top and side paddings were the same but the bottom padding was larger.
            You have to take into account the padding and border width usually when doing the width/height.

            Comment

            • Simon
              Confirmed User
              • Aug 2003
              • 189

              #7
              Originally posted by Mutt
              I'm trying to put a single pixel border around thumbnails with some padding between the thumbnail and border - and on hover the border will change color.
              You can do it by putting the class on the Image tag instead of the Anchor/Link tag.

              Code:
              <style type="text/css">
              a img.thumb {border:1px solid #000; padding:4px;}
              a:hover img.thumb {border:1px solid #fff; padding:4px;}
              </style>
              
              <a href="file.wmv"><img class="thumb" src="thumbnail.jpg" border="0" width="300" height="200" /></a>
              See most arguments on GFY explained in about 5 seconds
              email: simon <at> IndustryInc dot com | icq: 269~043~019
              "If you want a happy ending, that depends, of course, on where you stop your story."

              Comment

              • Kiopa_Matt
                Confirmed User
                • Oct 2007
                • 1448

                #8
                Not even a quick thank you to me for solving your problem?

                Dick... didn't your mom teach you manners? :P

                PS. Don't worry, I'm just drunk & joking.
                Last edited by Kiopa_Matt; 11-27-2010, 05:44 PM.
                xMarkPro -- Ultimate Blog Network Management
                Streamline your marketing operations. Centralize management of domains, pages, Wordpress blogs, sponsors, link codes, media items, sales and traffic statistics, plus more!

                Comment

                • munki
                  Do Fun Shit.
                  • Dec 2004
                  • 13393

                  #9
                  I love cock swallowing sluts.

                  I have the simplest tastes. I am always satisfied with the best.” -Oscar Wilde

                  Comment

                  Working...