[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2011-03-24
3
Medium Priority
?
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 2

Assisted Solution

by:ty2845mvn
ty2845mvn earned 400 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 800 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 800 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

649 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