Solved

How do you make a certain area of an image a hyperlink

Posted on 2011-03-24
3
259 Views
Last Modified: 2012-05-11
Hi!

Is there a way to make only the logo portion of the below mentioned header a hyperlink?
http://www.topsecurityinc.com/
Currently, the whole header is a hyperlink.
Here is the code:  
<a href="/"><img src="web/images/top-security-inc-header.jpg" style="width:829px;height:150px;margin-top:10px;border:0px" alt=""></a>
Any specific code modifications would be appreciated.
0
Comment
Question by:TrueBlue
3 Comments
 
LVL 2

Assisted Solution

by:ty2845mvn
ty2845mvn earned 100 total points
ID: 35211984
You'll want to use area and map if you are stuck using that image as your header.

<img src="web/images/top-security-inc-header.jpg" style="width:829px;height:150px;margin-top:10px;border:0px" alt="" usemap="#logomap">
<map name="logomap">
  <!-- replace the coordinates and shapes below to match your image -->
  <area shape="rect" coords="0,0,82,126" href="link1.html" alt="Link1" />
  <area shape="circle" coords="90,58,3" href="/" alt="Main Page" />
  <area shape="circle" coords="124,58,8" href="circle.html" alt="Circle" />
</map>

The shapes you can use are "rect", "circle", "poly", and "default".
For the coordinates:
x1,y1,x2,y2: If the shape attribute is set to "rect", it specifies the coordinates of the top-left corner and the bottom-right corner of the rectangle
x,y,radius: If the shape attribute is set to "circle", it specifies the coordinates of the circle center and the radius
x1,y1,x2,y2,..,xn,yn: If the shape attribute is set to "poly", it specifies the coordinates of the edges of the polygon. If the first and last coordinate pairs are not the same, the browser must add the last coordinate pair to close the polygon.

(Last bit lifted from http://www.w3schools.com/tags/att_area_coords.asp)
0
 
LVL 12

Assisted Solution

by:Amick
Amick earned 200 total points
ID: 35212066
Use an image map.  You may want to style imgmapdiv to display:none.
<div id="imgmapdiv">
			    	<map name="imgmap">
			    		<area shape="poly" coords="43,80,120,11,202,82" href="http://www.topsecurityinc.com" alt="www.topsecurityinc.com">
			    	</map>
			    </div>
			        <img style="width: 829px; height: 150px; margin-top: 10px; border-top-color: currentColor; border-right-color: currentColor; border-bottom-color: currentColor; border-left-color: currentColor; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none;" alt="Move mouse over image" usemap="#imgmap" src="http://www.topsecurityinc.com/web/images/top-security-inc-header.jpg"/>

Open in new window

0
 
LVL 10

Accepted Solution

by:
jtwcs earned 200 total points
ID: 35212111
An image map would work but you could also just make some minor changes to your css and markup to achieve the same result.

HTML changes:

Replace your "topgif" span with this,
<span class="topgif">
	<a href="/" title="Orlando Home & Business Security, Orlando Burglar Alarm Monitoring | Top Security Inc"></a>
</span>

Open in new window


CSS changes:

Replace your .topgif declaration with this,
.topgif a{margin-top:10px;display:block;width:210px;height:150px;}

Open in new window


Replace your .header declaration with this,  
.header{height:170px;width:829px;margin-left:0px;margin-top:0px;padding-top:5px;color:#3A6DEB;background-color:#FFF;letter-spacing:4px;background-image: url(/web/images/top-security-inc-header.jpg);background-repeat: no-repeat;background-position: 0px 25px;}

Open in new window


Hope this helps.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
HTML and CSS for a complex page 20 61
Sums of coloumns in html/java 15 67
Adding a Li to a UL after a specified Li contents 2 44
CSS z-index issue 3 20
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now