Home > Enterprise >  How do I add clickable text on an image
How do I add clickable text on an image

Time:11-18

I am completelly new to html and I need some quick help. I got this image here: enter image description here

I want to add some clickable texts that contains links when you click on them like this: enter image description here

How do I place clickable text on image and how can I make it change font color when a cursor is hovering on top of it.

Would greatly appreciate help on this. I can't figure out how do I add stuff on top of the image.

Thanks

EDIT:

I am trying to add the clickable links with: <a href="google.com">Text</a> But I can't figure out how to move it around so it just sits there under image like this:

This is what I got right now:

<div class="container">
  <img src="https://growingseedsavers.org/content/images/2021/11/asd.png" alt="Snow">
</div>
<body>
<a href="google.com">Text</a>

</body>

CodePudding user response:

From a single image used as a background and nowdays CSS possibilities, you can lay over it any tags enter image description here

here is an example using flex, grid and aspect-ratio and background . it can also wrap and you can add as many boxes as you need.

section {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5%;
}

div {
  background: url(https://i.stack.imgur.com/r13qs.png);
  width: 205px;
  aspect-ratio: 1/1.6;
  display: grid;
  grid-template-rows: 140px 1fr;
}

div h2 {
  margin-top: auto;
  padding-inline: 3ch;
  text-align: center;
}

div ul {
  padding: 0;
  margin: 0 0 25%;
  list-style: none;
}

li {
  font-weight: 900;
  padding-inline: 5ch;
}

li::before {
  content: "- ";
}

li a {
  color: inherit;
  text-decoration: none;
}

li a:hover {
  color: #834C61
}
<section>
  <div>
    <h2>TEXT</h2>
    <ul>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
    </ul>
  </div>
  <div>
    <h2>TEXT</h2>
    <ul>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
    </ul>
  </div>
  <div>
    <h2>TEXT</h2>
    <ul>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
    </ul>
  </div>
  <div>
    <h2>TEXT</h2>
    <ul>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
    </ul>
  </div>
  <div>
    <h2>TEXT</h2>
    <ul>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
      <li><a href="#">CT</a></li>
    </ul>
  </div>
</section>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  • Related