S
S
studio_orange2018-09-18 11:53:01
HTML
studio_orange, 2018-09-18 11:53:01

How to format a block as a link?

Good afternoon. The question is whether it is possible to design a link in this way to make the entire block clickable. Interested in correctness in terms of SEO promotion.

<div class="block__element">
    <a href="#"></a>
    <img src="<?= SITE_TEMPLATE_PATH; ?>/assets/pictures/image.jpg" alt="" class="block__bg">
    <div class="block__title">
         <span class="block__title-name">Жилищная инициатива</span>
         <p>ул. Попова №150</p>
    </div>
</div>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alexalexes, 2018-09-18
@alexalexes

Wrap the block in a link.

<a href="какая-то_ссылка">
<div class="block__element">
    <img src="<?= SITE_TEMPLATE_PATH; ?>/assets/pictures/image.jpg" alt="" class="block__bg">
    <div class="block__title">
         <span class="block__title-name">Жилищная инициатива</span>
         <p>ул. Попова №150</p>
    </div>
</div>
</a>

or so
<div class="block__element">
    <a href="какая-то_ссылка">
    <img src="<?= SITE_TEMPLATE_PATH; ?>/assets/pictures/image.jpg" alt="" class="block__bg">
    <div class="block__title">
         <span class="block__title-name">Жилищная инициатива</span>
         <p>ул. Попова №150</p>
    </div>
    </a>
</div>

For the A tag, only the href attribute is required - robots will analyze it as a transition point to another page.
Another use of the A tag is as an anchor on a page.
You tried to depict exactly this application, but the anchor is made using the name attribute, not the href.
<div class="block__element">
    <a name="какой-то_якорь"></a>
    <img src="<?= SITE_TEMPLATE_PATH; ?>/assets/pictures/image.jpg" alt="" class="block__bg">
    <div class="block__title">
         <span class="block__title-name">Жилищная инициатива</span>
         <p>ул. Попова №150</p>
    </div>
</div>

In order for the page to scroll exactly to this anchor when you go to it, you need to use a link like "page_address#some_anchor".

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question