- Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:188.8.131.52) Gecko/20060308 Firefox/184.108.40.206
- Windows Server 2003 R2
Firefox renders some HTML elements which are not expected to be displayed, when their
display CSS property is set to a value other than
Elements like <title>, <style> or <script> are not for display purpose. By default, their display CSS property is none. However, these elements, like <span> and <div>, are part of the DOM structure thus we can specify any property for them. What would happen if I specify display:block for all elements?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
/* CSS source is displayed*/
<p>Bug: Why does firefox display the source code? :)</p>
The universal selector * matches all elements including <title>, <style> and <script>. Firefox displays the page as follows.
This seems buggy to any end-user but is technically reasonable. It indicates that Firefox treats all html elements in a uniform way. However, according to the semantic meaning, those elements should never be rendered.