Home > other >  How to prevent blockquote's footer from appearing as global footer on print page
How to prevent blockquote's footer from appearing as global footer on print page

Time:09-06

I've got a page, which contains some citations in blockquotes, with the associated source in a nested footer element.

For instance

<!-- some html content -->

<blockquote>
 My very looooong citation about something ............
<footer>
  <cite> The Jungle book, p. 43 </cite>
 </footer>
</blockquote>

<! -- more html -->

The problem is that when I print the page, the content from the footer element gets added to the global footer of the printed page.

Any solution?

CodePudding user response:

From MDN on <footer>:

The HTML element represents a footer for its nearest ancestor sectioning content or sectioning root element

As <blockquote> is not sectioning content, it’s not valid to use the <footer> element inside it to provide additional information for the quote. (Sectioning content elements are article, aside, nav, section. Finally body will be the referenced element.)

Instead, the next ancestor sectioning content is used. In your case I’m assuming that that content is spread on several pages, therefore the footer is repeated as well.

You could wrap the quote in a sectioning element, but it seems semantically more correct to simply not use the <footer> element. <cite> is already doing enough.

  • Related