The weirdest HTML feature (or bug?): display your head
a year ago
- #HTML
- #Web Development
- #CSS
- The head of an HTML document is not displayed by default in browsers, but can be made visible with CSS.
- Elements like <script>, <style>, and <title> are hidden by default due to their 'display: none' property in browser stylesheets.
- Using CSS, these elements can be displayed by overriding the default 'display' property.
- A real-world example involves a browser extension adding custom elements that unexpectedly displayed due to page CSS.
- There's debate over whether this behavior is a bug or a feature, with no clear consensus.
- A workaround involves adding specific styles to ensure <style> elements remain hidden.