I am not sure whether is it correct to have <h2> tag inside <summary> tag.
Whether semantically it is valid to have <h2> or <h1> tag inside <summary> tag?
I am not sure whether is it correct to have <h2> tag inside <summary> tag.
Whether semantically it is valid to have <h2> or <h1> tag inside <summary> tag?
                        
                            
                        
                        
                            On
                            
                            
                                                    
                    
                Sure, it is allowed. But you have to style a bit with CSS to avoid wrapping. To test the aviabillity use the W3-Validator and use the W3Schools as well.
<!DOCTYPE html>
<html>
<head>
    <title>HTML Summary usage</title>
</head>
<body>
  <details>
    <summary><h1>Copyright 1999-2014.</h1></summary>
    <p> - by Refsnes Data. All Rights Reserved.</p>
    <p>All content and graphics on this web site are the property of the company Refsnes Data.</p>
  </details>
  <p><b>Note:</b> The summary element is not supported in Edge/Internet Explorer.</p>
</body>
</html>
                        
The semantics would depend on the specific content you had and the context it appears in.
From a validity point of view, the spec says:
So, it is valid.