Forma
Forma

Reputation: 13

href syntax for a button (HTML)

I have created a button, as shown below. Now I am working on linking it. However the href part seems to be out of order. Does anyone know how to link the button to a site (use https://aol.com). Thank you

<body>
    <div class="result15823794" style="width: 160px; height: 30px;     background-image:     url(&quot;http://static1.grsites.com/user/generate/items/button84799376.png&quot    ;);
    " onmouseover="this.style.backgroundImage =     'url(http://static1.grsites.com/user/generate/items/button76804217.png)'
    " onmouseout="this.style.backgroundImage =     'url(http://static1.grsites.com/user/generate/items/button84799376.png)'">
    <div style="background-image:     url(http://static1.grsites.com/images/0.gif); 
    width: 160px; height: 30px;"></div>
    </div>
</body>

Upvotes: 1

Views: 2370

Answers (3)

wrines wr ines
wrines wr ines

Reputation: 1

<a href="https://aol.com" target="_blank">

add this after the body the <body> tag, then add the closing of the anchor tag before the closing </body> tag. Just like my code below.

<body>
    <a href="https://aol.com" target="_blank">
    <div class="result15823794" style="width: 160px; height: 30px;     background-image:     url(&quot;http://static1.grsites.com/user/generate/items/button84799376.png&quot    ;);
    " onmouseover="this.style.backgroundImage =     'url(http://static1.grsites.com/user/generate/items/button76804217.png)'
    " onmouseout="this.style.backgroundImage =     'url(http://static1.grsites.com/user/generate/items/button84799376.png)'">
    <div style="background-image:     url(http://static1.grsites.com/images/0.gif); 
    width: 160px; height: 30px;"></div>
    </div>
    </a>
</body>

Upvotes: 0

nineusa
nineusa

Reputation: 1

you can wrap the outmost div with an anchor containing the href to AOL like this:

<a href="https://aol.com/"><div class="result15823794" style="width: 160px; height: 30px;     background-image:     url(&quot;http://static1.grsites.com/user/generate/items/button84799376.png&quot    ;);
    " onmouseover="this.style.backgroundImage =     'url(http://static1.grsites.com/user/generate/items/button76804217.png)'
    " onmouseout="this.style.backgroundImage =     'url(http://static1.grsites.com/user/generate/items/button84799376.png)'">
    <div style="background-image:     url(http://static1.grsites.com/images/0.gif); 
    width: 160px; height: 30px;"></div>
    </div></a>

Upvotes: 0

Chris Happy
Chris Happy

Reputation: 7295

onclick="location.href='https://aol.com/';"

Sample:

<body>
  <div onclick="location.href='https://aol.com/';" class="result15823794" style="width: 160px; height: 30px;     background-image:     url(&quot;http://static1.grsites.com/user/generate/items/button84799376.png&quot    ;);
        " onmouseover="this.style.backgroundImage =     'url(http://static1.grsites.com/user/generate/items/button76804217.png)'
        " onmouseout="this.style.backgroundImage =     'url(http://static1.grsites.com/user/generate/items/button84799376.png)'" onclick="location.href='https://aol.com/';">
    <div style="background-image:     url(http://static1.grsites.com/images/0.gif); 
        width: 160px; height: 30px;"></div>
  </div>
</body>

Upvotes: 1

Related Questions