Difference between semantic and non-semantic elements
Semantic HTML elements:
These elements simply mean, elements with meaning. The reason being, there definition in the code tells the browser and the developer what they are supposed to do. Framing in simpler words, these elements describe the type of content they are supposed to contain.
Following is the list of some semantic elements :
Example: The following program contains some semantic elements to explain the context better:
Non-Semantic elements: Unlike, semantic elements they don’t have any meaning. They don’t tell anything about the content they contain. They can be used with different attributes to mark up semantics common to a group.
Following is the list of some non-semantic elements:
The following code depicts how non-semantic elements work:
Difference between semantic and non-semantic elements:
|Semantic elements||Non-Semantic elements|
|they have meaning||they don’t have meaning|
|they describe how the content within them is supposed to behave||they can contain anything|
|they have specific attributes for their structure||‘class’ attribute can be used to work with their structure|