What am I doing wrong??????

`<div style="text-align:center" >
  <a ref="http://www.bbb.org/san-diego/business-reviews/paving-contractors/north-county-pavers-inc-in-oceanside-ca-171992592" >
    <img src="images/bbbsealh1US.gif" width="90" height="34" alt="BBB Accredited Business" /></a>
</div>  <!--  Close div style=text-align:center  -->

`

It's probably simple, but I guess I have lost my objectivity...

Thanks, in advance!!

< Steve >

Dani AI

Generated

As noted, the anchor attribute was mistyped. In 's snippet the attribute value also contained HTML (another anchor tag and attributes) instead of a plain URL, which prevents the browser from creating a real link. That combination of a wrong attribute name, nested markup inside an attribute, and mismatched quoting is the usual culprit when an image won't act as a hyperlink.

A clean, minimal pattern that avoids those problems:

<div style="text-align:center;">
  <a href="https://example.com/" rel="nofollow noopener noreferrer" target="_blank" aria-label="View accreditation listing">
    <img src="/images/badge.gif" alt="Accredited business seal" width="90" height="34">
  </a>
</div>

Notes and best practices:

  • Keep the href value a plain URL string; do not place HTML inside attribute values.
  • If opening links in a new tab use target="_blank" plus rel="noopener noreferrer" for security; add nofollow only where appropriate.
  • Use descriptive alt (or aria-label) for accessibility. For responsive layouts prefer CSS rules like max-width:100%; height:auto; instead of fixed pixel dimensions.
  • When something still behaves oddly, inspect the DOM with browser devtools or run the markup through the W3C validator. For reference on anchor attributes see the MDN docs: HTML anchor element and rel attribute.

Recommended Answers

All 2 Replies

it should be href not ref in your anchor tag.

commented: Thank you!! for your speedy reply! Do appreciate the help! +1

Da--! Told you it was something simple. Sorry I'm blind.

(I really had to check my code - I was shaking my head after I read your post...)

Thank you, Kind Sir!! If you ever make it to California...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.