Sashi yadav
Sashi yadav

Reputation: 358

Semantic and non Semantic elements

Is <a> tag is a semantic or non semantic element. By definition of semantic element it feels like <a> should be a semantic element. Can somebody explain me how we categorize the elements into semantic and non semantic

Upvotes: 2

Views: 4609

Answers (3)

Seniru Ranasinghe
Seniru Ranasinghe

Reputation: 1

Simply:

  • Non-semantic elements in HTML don't give any idea other than their type.

For example, <p> only gives us the idea of paragraph text.

  • But semantic elements tell us what they are and how they relate to the webpage.

For example, <header> indicates the place where the page begins and may contain some navigation links (not a sitemap). <article> suggests a form, post, or newspaper article on the page.

For your question, <a> is also semantic element. Because it clearly describes its meaning to both the browser and the developer.

Upvotes: 0

keizah7
keizah7

Reputation: 743

Semantics is the study of the meanings of words and phrases in a language.

Semantic elements = elements with meaning.

A semantic element clearly describes its meaning to both the browser and the developer. Examples of non-semantic elements: <div> and <span> - Tells nothing about its content. Examples of semantic elements: <form>, <table>, and <article> - Clearly defines its content.

https://www.w3schools.com/html/html5_semantic_elements.asp

<a> is non-semantic element

Upvotes: 7

Phil
Phil

Reputation: 321

The IT Semantic: picking a variable name which is logical, and describes its purpose,

Since we are name everything in IT: servers, tables, classes, columns, functions and variables these mechanisms are not arbitrary, if they are chosen right the system is arguably more intuitive, for an English speaker, or same language speaker.

HTML has various semantic, and infamously counter intuitive tag names, due to the requirement it must be backwards compatible.

The <A> tag should be <LINK> unless the purpose was to conserve bits, there is no reason to make the fundamental purpose of HTML (hyperlinks) 1 character long, and why not <L>?

To convey meaning, semantic names should probably not be abbreviated, a verb (get, or set) for a function and a noun for an entity.

Upvotes: 1

Related Questions