/    Sign up×
Community /Pin to ProfileBookmark

Modify <a> into a button image

The pure <a></a> only displays as a link. But I saw it can be modified into a button like image. For instance, <a class=”xxxx” href=”xxxxx.com”> Some Name</a>. This is achieved POSSIBLY via the class attribute.

How could it be done?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERAug 16.2012 — Your request is unclear to me, so this is just a SWAG...
<i>
</i>&lt;!DOC HTML&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt; Untitled &lt;/title&gt;
&lt;style type="text/css"&gt;
.anchorButton { height:75px; width:100px; }
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;a href="#" onclick="alert('Go someplace');return false"&gt;
&lt;img src="http://upload.wikimedia.org/wikipedia/commons/9/92/Easy_button.JPG" class="anchorButton"&gt;
&lt;/a&gt;
&lt;br&gt;
&lt;a href="#" onclick="alert('Go someplace else');return false"&gt;
&lt;img src="http://25.media.tumblr.com/tumblr_m8s5qtbyI41qe1z7co1_400.gif" class="anchorButton"&gt;
&lt;/a&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@theCoenAug 17.2012 — [code=html]<style type="text/css">
.button {
padding: 5px;
background: #ddd;
border-top: 1px solid #eee; border-left: 1px solid #eee;
border-bottom: 1px solid #ccc; border-right: 1px solid #ccc;
}
.button:hover {
padding: 5px;
background: #ddd;
border-top: 1px solid #ccc; border-left: 1px solid #ccc;
border-bottom: 1px solid #eee; border-right: 1px solid #eee;
}
</style>
<a href="http://www.google.com/" class="button">Button</a>[/code]


Something like that?
Copy linkTweet thisAlerts:
@JMRKERAug 17.2012 — Or possibly?
<i>
</i>&lt;!DOCTYPE HTML&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt; CSS image button &lt;/title&gt;
&lt;!-- From: http://www.webdeveloper.com/forum/showthread.php?t=263658
and: http://www.webdeveloper.com/forum/showthread.php?t=263625
--&gt;
&lt;style type="text/css"&gt;

#btn1 {
height:100px; width:100px;
background-image: url("http://upload.wikimedia.org/wikipedia/commons/9/92/Easy_button.JPG");
background-size: 100px 100px;
background-repeat: no-repeat;
display: inline-block;
}
#btn2 {
height:100px; width:100px;
background-image: url("http://25.media.tumblr.com/tumblr_m8s5qtbyI41qe1z7co1_400.gif");
background-size: 100px 100px;
background-repeat: no-repeat;
display: inline-block;
}

.button {
border-top: 2px solid #ccc; border-left: 2px solid #ccc;
border-bottom: 4px solid #333; border-right: 4px solid #333;
}
.button:hover {
border-top: 4px solid #333; border-left: 4px solid #333;
border-bottom: 2px solid #ccc; border-right: 2px solid #ccc;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;

&lt;a href="http://www.google.com/" id="btn1" class="button"&gt; &lt;/a&gt;
&lt;a href="http://www.webdeveloper.com/" id="btn2" class="button"&gt; &lt;/a&gt;

&lt;/body&gt;
&lt;/html&gt;
×

Success!

Help @scottjsn spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...