www.webdeveloper.com
Results 1 to 2 of 2

Thread: border color

  1. #1
    Join Date
    Jul 2006
    Posts
    653

    border color

    Hi, i have a div that contains an image with a border around it. The image is a link to another page. How do i change the color of the border when the mouse moves over the image.

    here is my CSS:

    Code:
    .sector_images 
    	{
    	height: 100px;
    	width: 150px;
    	float: left;
    	margin: 0px 12px 12px 0px;
    	border: 5px solid #000000;
    	}
    and here is my code:

    HTML Code:
    <div class="sector_images"><a href="page.php" target="_self"><img src="images/image.jpg" alt="image" width="150" height="100" /></a></div>

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    The .hover pseudo class currently works only on anchors. If you move your border to the anchor and make the img border 0, you could use css to do it.

    Otherwise you will have to throw some javascript at it to change the border-color onmouseover:
    Code:
    <img src="..." onmouseover="this.style.borderColor='red'" onmouseout="this.style.borderColor='black'">

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles