Semantic HTML: Difference between revisions

Content deleted Content added
m History: Formatting update to include < and > around tag names.
m move schema.org from External links to See also, MOS:OVERLINK
 
(10 intermediate revisions by 10 users not shown)
Line 1:
{{Redirect|Semantic markup|more general usage|separation of content and presentation|semantics in programming languages|Semantics (computer science)}}
{{Short description|HTML used to reinforce meaning of documents or webpages}}
[[File:HTML element content categories.pngsvg|thumb|HTML element content categories]]
'''Semantic HTML''' is the use of [[HTML]] markup to reinforce the [[semantics]], or meaning, of the information in [[Webweb page|web pages]]s and [[web application]]s rather than merely to define its [[Model–view–presentermodel–view–presenter|presentation or look]]. Semantic HTML is processed by traditional [[web browser]]s as well as by many other [[user agent]]s. [[Cascading Style Sheets|CSS]] is used to suggest itshow presentationit is presented to human users.
 
== History ==
HTML has included semantic markup since its inception.<ref>{{cite book |last1=Berners-Lee |first1=Tim |author-link1=Tim Berners-Lee |last2=Fischetti |first2=Mark |title=Weaving the Web: The Original Design and Ultimate Destiny of the World Wide Web by Its Inventor|url=https://archive.org/details/weavingweborigin00bern_0|url-access=registration |isbn=978-0062515872 |publisher=Harper |___location=San Francisco |year=2000 |url=https://archive.org/details/weavingweborigin00bern_0 |url-access=registration}}</ref> In an HTML document, the author may, among other things, "start with a title; add headings and paragraphs; add emphasis to [the] text; add images; add links to other pages; [and] use various kinds of lists".<ref>{{cite web| url=http://www.w3.org/MarkUp/Guide/Overview.html|title=Getting started with HTML |last=Raggett |first=Dave |author-link=Dave Raggett |date=24 April 2005 |publisher=[[World Wide Web Consortium]] |url=https://www.w3.org/MarkUp/Guide/Overview.html |access-date=8 December 2010}}</ref>
 
Various versions of the HTML standard have included [[HTML element#Presentation|presentational markup]] such as <code>&lt;font&gt;</code> (added in HTML 3.2; removed in HTML 4.0 Strict), <code>&lt;i&gt;</code> (all versions) and <code>&lt;center&gt;</code> (added in HTML 3.2). There are also the semantically neutral [[span and div]] elements. Since the late 1990s when [[Cascading Style Sheets]] were beginning to work in most browsers, web authors have been encouraged to avoid the use of presentational HTML markup with a view to the [[separation of content and presentation]].<ref>{{cite web|url=http://www.w3.org/MarkUp/Guide/Style.html |title=Adding a touch of style |last=Raggett |first=Dave |date=8 April 2002 |publisher=World Wide Web Consortium |url=https://www.w3.org/MarkUp/Guide/Style.html |access-date=8 December 2010}} This article notes that presentational HTML markup may be useful when targeting browsers "before [[Netscape Communicator|Netscape 4.0]] and [[Internet Explorer 4|Internet Explorer 4.0]]" which were both released in 1997.</ref>
 
In 2001, [[Tim Berners-Lee]] participated in a discussion of the [[Semantic Web]], where it was presented that intelligent software 'agents' might one day automatically trawlcrawl the Web and find, filter and correlate previously unrelated, published facts for the benefit of end users.<ref>{{cite web | url=http://www.scientificamerican.com/article.cfm?id=the-semantic-web|title=The Semantic Web|first1=Tim |last1=Berners-Lee |first2first1=JamesTim |last2=Hendler |first3first2=OraJames |last3=Lassila |first3=Ora |publisher=Scientific American |year=2001 |url=https://www.scientificamerican.com/article/the-semantic-web/ |access-date=2009-10-02}}</ref> Such agents are not commonplace even now, but some of the ideas of [[Web 2.0]], [[Mashupmashup (web application hybrid)|mashups]] and [[Priceprice comparison service|price comparison websites]] may be coming close. The main difference between these web application hybrids and Berners-Lee's semantic agents lies in the fact that the current [[news aggregator|aggregation]] and hybridisation of information is usually designed in by web developers, who already know the web locations and the [[Application programming interface|API semantics]] of the specific data they wish to mash, compare and combine.
 
An important type of web agent that does crawl and read web pages automatically, without prior knowledge of what it might find, is the [[Webweb crawler]] or search-engine spider. These software agents are dependent on the semantic clarity of web pages they find as they use various techniques and [[algorithm]]s to read and index millions of web pages a day and provide web users with [[Webweb search engine|search facilities]].
 
In order for search-engine spiders to be able to rate the significance of pieces of text they find in HTML documents, and also for those creating mashups and other hybrids, as well as for more automated agents as they are developed, the semantic structures that exist in HTML need to be widely and uniformly applied to bring out the meaning of published information.<ref name="Semantic_Web_Revisted">{{cite web|url=http://eprints.ecs.soton.ac.uk/12614/1/Semantic_Web_Revisted.pdf |title=The Semantic Web Revisited|first1=Nigel |last1=Shadbolt |first3first1=WendyNigel |last3last2=HallBerners-Lee |first2=Tim |last2last3=Berners-LeeHall |first3=Wendy |publisher=IEEE Intelligent Systems |date=May–June 2006 |url=http://eprints.ecs.soton.ac.uk/12614/1/Semantic_Web_Revisted.pdf |access-date=8 December 2010}}</ref>
 
While the true semantic web may depend on complex [[Resource Description Framework|RDF]] [[Ontologyontology (information science)|ontologies]] and [[metadata]], every HTML document makes its contribution to the meaningfulness of the Web by the correct use of headings, lists, titles and other semantic markup wherever possible. This "plain" use of HTML has been called "Plain Old Semantic HTML" or POSH.<ref>{{cite web |url=http://microformats.org/wiki/posh |title=Plain Old Semantic HTML (POSH) |date=April 20, 2007 |website=Microformats Wiki |publisher=microformats community |url=https://microformats.org/wiki/posh |access-date=May 4, 2013}}</ref> The correct use of Web 2.0 'tagging' creates [[Folksonomyfolksonomy|folksonomies]] that may be equally or even more meaningful to many.<ref name="Semantic_Web_Revisted"/> [[HTML 5]] introduced new semantic elements such as <code>&lt;section&gt;</code>, <code>&lt;article&gt;</code>, <code>&lt;footer&gt;</code>, <code>&lt;progress&gt;</code>, <code>&lt;nav&gt;</code>, <code>&lt;aside&gt;</code>, <code>&lt;mark&gt;</code>, and <code>&lt;time&gt;</code>.<ref>{{cite web |last1=Robinson |first1=Mike |title=Let's Talk about Semantics |publisher=HTML 5 Doctor |url=httphttps://html5doctor.com/lets-talk-about-semantics/|publisher=HTML 5 Doctor|access-date=26 October 2015}}</ref> Overall, the goal of the [[W3C]] is to slowly introduce more ways for browsers, developers, and crawlers to better distinguish between different types of data, allowing for benefits such as better display on browsers on different devices.
 
Presentational elements were not formally [[Deprecationdeprecation|deprecated]] in HTML 4.01 and XHTML recommendations, but were recommended against. In HTML 5, some of those elements, such as <code>&lt;i&gt;</code> and <code>&lt;b&gt;</code>, are still specified as their meaning has been clearly defined "as to be stylistically offset from the normal prose without conveying any extra importance".<ref>{{cite web |title=HTML5 |at=Section 4.5.17: The i element |publisher=World Wide Web Consortium |url=https://wwwhtml.spec.w3whatwg.org/TR/html5multipage/text-level-semantics.html#the-i-element |publisher=World Wide Web Consortium }}</ref><ref>{{cite web |title=HTML5 |at=Section 4.5.18: The b element |publisher=World Wide Web Consortium |url=https://wwwhtml.w3spec.whatwg.org/TR/html5multipage/text-level-semantics.html#the-b-element |publisher=World Wide Web Consortium }}</ref>
 
== Considerations ==
In cases where a document requires more precise semantics than those expressed in HTML alone, fragments of the document may be enclosed within <code>span</code> or <code>div</code> elements with meaningful class names<ref>These class names are at best suggestive rather than formally meaningful, unless they are previously shared between both creator and consumer of the content.</ref> such as <code>&lt;span class="author"&gt;</code> and <code>&lt;div class="invoice"&gt;</code>. Where these class names are also a [[fragment identifier]] within a schema or ontology, they may link to a more defined meaning. [[Microformat]]s formalise this approach to semantics in HTML.
 
One important restriction of this approach is that such markup based on element inclusion must meet the well-formedness conditions. As these documents are broadly tree-structured, this means that only balanced fragments from a sub-tree can be marked up in this way.<ref>{{cite web | title=Well-Formed XML Documents | work=Extensible Markup Language (XML) 1.1 |publisher=[[W3C]] |url=httphttps://www.w3.org/TR/2004/REC-xml11-20040204/#dt-wellformed | publisher=[[W3C]] }}</ref><ref>{{cite web | title=Conceitos importantes sobre HTML |publisher=[[Bendev Junior]] |language=es |url=https://blog.bendevoficial.com/posts/conceitos-importantes-sobre-html | publisher=[[Bendev Junior]] }}</ref> A means of marking-up any arbitrary section of HTML would require a mechanism independent of the markup structure itself, such as [[XPointer]].
 
Good semantic HTML also improves the [[accessibility]] of web documents (see also [[Web Content Accessibility Guidelines]]).{{Citation needed|date=October 2015}} For example, when a screen reader or audio browser can correctly ascertain the structure of a document, it will not waste the visually impaired user's time by reading out repeated or irrelevant information when it has been marked up correctly.
== Google "rich snippets" ==
In 2010, [[Google]] specified three forms of structured metadata that their systems will use to find structured semantic content within webpages. Such information, when related to reviews, people profiles, business listings, and events will be used by Google to enhance the "snippet", or short piece of quoted text that is shown when the page appears in search listings. Google specifies that that data may be given using [[Microdata (HTML5)|microdata]], [[microformat]]s or [[RDFa]].<ref>{{cite web|title=Rich snippets|url=http://www.google.com/support/webmasters/bin/answer.py?answer=99170|work=Webmaster Central|access-date=26 May 2010}}</ref> Microdata is specified inside <code>itemtype</code> and <code>itemprop</code> attributes added to existing HTML elements; microformat keywords are added inside <code>class</code> attributes as discussed above; and RDFa relies on <code>rel</code>, <code>[[typeof]]</code> and <code>property</code> attributes added to existing elements.<ref>{{cite web|title=Businesses and organizations - About organization information|url=http://www.google.com/support/webmasters/bin/answer.py?answer=146861|work=Webmaster Central|access-date=26 May 2010}}</ref>
 
==Google See also"rich snippets"==
In 2010, [[Google]] specified three forms of structured metadata that their systems will use to find structured semantic content within webpages. Such information, when related to reviews, people profiles, business listings, and events will be used by Google to enhance the "snippet", or short piece of quoted text that is shown when the page appears in search listings. Google specifies that that data may be given using [[Microdatamicrodata (HTML5)|microdata]], [[microformat]]s or [[RDFa]].<ref>{{cite web |title=Rich snippets |work=Webmaster Central |url=http://www.google.com/support/webmasters/bin/answer.py?answer=99170|work=Webmaster Central|access-date=26 May 2010}}</ref> Microdata is specified inside <code>itemtype</code> and <code>itemprop</code> attributes added to existing HTML elements; microformat keywords are added inside <code>class</code> attributes as discussed above; and RDFa relies on <code>rel</code>, <code>[[typeof]]</code> and <code>property</code> attributes added to existing elements.<ref>{{cite web |title=Businesses and organizations - About organization information |work=Webmaster Central |url=http://www.google.com/support/webmasters/bin/answer.py?answer=146861|work=Webmaster Central|access-date=26 May 2010}}</ref>
 
==See also==
{{Portal|Computer programming|Internet}}
* [[CP/LD]] (Content Profile/Linked Document)
* [[HTML elementselement]]s (complete list)
* [[HTML landmarks]]
* [[Microdata (HTML)]]
* [[Microformat]]
* [[RDFa]]
* [http://www.schema.org/ [schema.org]] is an initiative launched on 2 June 2011 by [[Bing (search engine)|Bing]], [[Google]] and [[Yahoo!]]
* [[Microformats]]
* [[Semantic Web]]
* [[HTML landmarks]]
* [[Semantics (computer science)]]
* [[XML]]
* [[Microdata (HTML)]]
* [[HTML elements]] (complete list)
 
== References ==
{{reflistReflist|230em}}
== External links ==
* [http://www.schema.org/ schema.org] is an initiative launched on 2 June 2011 by [[Bing (search engine)|Bing]], [[Google]] and [[Yahoo!]]
 
{{Semantic Web}}
 
{{DEFAULTSORT:Semantic Html}}
[[Category:Semantic HTML| ]]
[[Category:Domain-specific knowledge representation languages]]