Solved

howto put image in button

Posted on 2011-09-07
5
215 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
[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
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
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 position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…

739 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