question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

HTML Link Positioning Answer is incorrect

See original GitHub issue

Since the HTML5 specification it is no longer recommended to include the optional <head> tag.

https://google.github.io/styleguide/htmlcssguide.html#Optional_Tags

The body tag is also not always required. https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission

Including both of these tags just increase the amount the browser must parse before rendering the page. It also increase the payload size.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kdgyimahcommented, Sep 22, 2021

Since the HTML5 specification it is no longer recommended to include the optional <head> tag.

https://google.github.io/styleguide/htmlcssguide.html#Optional_Tags

The body tag is also not always required. https://html.spec.whatwg.org/multipage/syntax.html#syntax-tag-omission

Including both of these tags just increase the amount the browser must parse before rendering the page. It also increase the payload size.

Including the <head> and <body> tag increases the payload size? I can understand the need to optimize for performance and fast loading times, but I should think there are far better ways of solving this. I.e

  1. Compressing and optimizing your images. (Either using the WebP/JPEG 2000/JPEG XR image format, Lazyloading, etc.)
  2. Caching your site
  3. Deferred loading for CSS and JS files
  4. Minifying the files
  5. Leveraging on CDNs

I should think there are more ways than this but removing the <head> and <body> tag sounds like trouble, considering Browser support may not be there yet for the user who may be visiting your site or application? I think it is best to leave it as is @Millsky 🙂

0reactions
yangshuncommented, Sep 7, 2022

Agree with what @kdgyimah said. The performance gains are likely to not be significant enough to warrant this change. The Hacker News comments outlines more issues with doing this.

But I’ll modify the answer to inform readers about this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Anchor link landing in wrong position - html - Stack Overflow
I think the problem is resulting from the anchors with no contents that you are using. Also, it appears that name= has been...
Read more >
Links in HTML documents - W3C
The A element's content defines the position of the anchor. The name attribute names the anchor so that it may be the destination...
Read more >
Positioning - Learn web development | MDN
Positioning allows you to take elements out of normal document flow and make them behave differently, for example, by sitting on top of...
Read more >
Need help with positioning box link in CSS
I assume it has to do with my positioning commands in the CSS or that I've placed the anchor tag on the wrong...
Read more >
URL Canonicalization and the Canonical Tag | Documentation
When a site has duplicate content, Google chooses the canonical URL. Learn more about canonical URLs and how to consolidate duplicate URLs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found