Skip to main content
Participant
Jul 15, 2021 8:56 PM UTC
Answered

Help adding a hyperlink to a banner

I have attempted moving the link around inside the div, moving the div in and out of the body.... copy and paste different peoples instructions i found on google, nothing works to get this banner image to hyperlink. I'm sure I am missing something simple. My code also has an error that says something needs to be closed and I can't for the life of me figure it out.

 

```<div id="RightFloatAds" style="right: 0px; position: fixed; text-align: center; top: 65px; background-color:black;color:black;border:5px solid black;" <a target="_blank" href="www.yahoo.com"><img src="banner1news.png" width="160" height="725" alt=""</a></div>```

This topic is closed to new replies. Start a new post to keep the conversation going.
osgood_Correct answer
Legend
Jul 15, 2021 9:32 PM UTC

Try adding the closing div and img tag > (see the 2 instances where they are missing, marked in red below):

 

<div id="RightFloatAds" style="right: 0px; position: fixed; text-align: center; top: 65px; background-color:black; color:black; border: 5px solid black;">

<a target="_blank" href="www.yahoo.com"><img src="banner1news.png" width="160" height="725" alt=""></a>

</div>



 

4 replies

Nancy OShea
Community Expert
Community Expert
Jul 17, 2021 7:58 PM UTC

Why are you using so many inline styles in your markup?  Unless this is an email newsletter, CSS styles rightfully belong in an external or embedded stylesheet.  And if this is an email, you should use absolute urls to assets located on a publicly accessible server.

 

 

<div>
<a href="https://example.com/"><img src="https://dummyimage.com/500x100.jpg" alt="placeholder" title="Link to Example.com"></a>
<div>

 

 

Working example of code above:

placeholder
 
Translate
Nancy O'Shea— Product User & Community Expert
osgood_Correct answer
Legend
Jul 15, 2021 9:32 PM UTC

Try adding the closing div and img tag > (see the 2 instances where they are missing, marked in red below):

 

<div id="RightFloatAds" style="right: 0px; position: fixed; text-align: center; top: 65px; background-color:black; color:black; border: 5px solid black;">

<a target="_blank" href="www.yahoo.com"><img src="banner1news.png" width="160" height="725" alt=""></a>

</div>



 

Translate
Liam Dilley
Inspiring
Jul 16, 2021 2:53 AM UTC

If you can as well move away from inline styles.

While not required in HTML5 it is nice to try keep symatic markup and fundementals in place when coding (for me anyway) so properly closing the image /> is what I would do.

Translate
BenPleysier
Community Expert
Community Expert
Jul 16, 2021 4:40 AM UTC

I tend to disagree with an unneccessary keystroke. What I find intriguing is the fact that `srcset` is never mentioned.

Translate
Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!