Skip to main content
Participant
July 15, 2021
Answered

Help adding a hyperlink to a banner

  • July 15, 2021
  • 2 replies
  • 455 views

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 has been closed for replies.
Correct answer osgood_

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>



 

2 replies

Nancy OShea
Community Expert
Community Expert
July 17, 2021

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
 
Nancy O'Shea— Product User & Community Expert
osgood_Correct answer
Legend
July 15, 2021

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>



 

Liam Dilley
Inspiring
July 16, 2021

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.

BenPleysier
Community Expert
Community Expert
July 16, 2021

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

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