最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

gallery - Can I nest a <figcaption> element within <a> tags from default wordpress?

programmeradmin0浏览0评论

I am making a page with Gutenberg but there is a problem that the link does not work within a . This is the code when I inspect:

<figure>
  <a href="...">
  <img>
  </a>
  <figcaption>
  </figcaption>
</figure>

Is there some way that I could nested the figcaption within the a tags so it could be clickable ? I can not modify the code because it is generated by Wordpress.

The expected output:

<figure>
  <a href="...">
  <img>
  <figcaption>
  </figcaption>
  </a>

</figure>

I am making a page with Gutenberg but there is a problem that the link does not work within a . This is the code when I inspect:

<figure>
  <a href="...">
  <img>
  </a>
  <figcaption>
  </figcaption>
</figure>

Is there some way that I could nested the figcaption within the a tags so it could be clickable ? I can not modify the code because it is generated by Wordpress.

The expected output:

<figure>
  <a href="...">
  <img>
  <figcaption>
  </figcaption>
  </a>

</figure>
Share Improve this question asked Mar 26, 2019 at 9:21 Linh NguyenLinh Nguyen 112 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

The only solution I know is manipulating the DOM in Javascript: Select all figure containing an a, look for its figcaption and append it to the a.

发布评论

评论列表(0)

  1. 暂无评论