Solved

howto put image in button

Posted on 2011-09-07
5
210 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
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 …
In this tutorial viewers will learn how to embed an audio file in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: : The declaration should display (CODE) HTML5 is supported by the most recent versions of all major browsers…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

760 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

25 Experts available now in Live!

Get 1:1 Help Now