Solved

howto put image in button

Posted on 2011-09-07
5
212 Views
Last Modified: 2012-05-12
I'm trying to put an image in a button, but I can't seem to do it without the extra space on either side of the image (see attached image). How do I do this? Here's what I have:

<button type=button onclick="window.open('tmp/ACHtrans.jsp','_BLANK')">
      <img style="margin: 0; border: 0" src=images/download.jpg>
    </button>

button.JPG
0
Comment
Question by:jmarkfoley
  • 2
  • 2
5 Comments
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36500458
No need to use button
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<style>
		a.button
		{
			border:2px solid #ccc;
		}
		a.button img
		{
			width:100px;
			height:25px;
		}
	</style>
</HEAD>

<BODY>
	<a href="javascript:window.open('tmp/ACHtrans.jsp','_BLANK')" class="button"><img src="lastscan.jpg"/></a>
</BODY>
</HTML>

Open in new window

0
 
LVL 16

Accepted Solution

by:
santoshmotwani earned 500 total points
ID: 36500475
<INPUT TYPE="image" SRC="images/download.jpg" HEIGHT="30" WIDTH="173" BORDER="0" ALT="Submit Form">
0
 
LVL 1

Author Closing Comment

by:jmarkfoley
ID: 36500510
That's a winner! Thanks
0
 
LVL 40

Expert Comment

by:gurvinder372
ID: 36500515
And why not mine??
0
 
LVL 1

Author Comment

by:jmarkfoley
ID: 36507361
gurvinder372: Yours would have worked too (with additionally removing the blue border), but santoshmotwani's was far simpler without dealing with styles for the href tag, so I picked that one.

My implementation:

<input type=image src=images/download.jpg onclick="location='tmp/ACHtrans.jsp'">
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

809 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