<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://microformats.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SqrY0r</id>
	<title>Microformats Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://microformats.org/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=SqrY0r"/>
	<link rel="alternate" type="text/html" href="https://microformats.org/wiki/Special:Contributions/SqrY0r"/>
	<updated>2026-05-11T16:50:27Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.38.4</generator>
	<entry>
		<id>https://microformats.org/wiki/index.php?title=class-design-pattern&amp;diff=17895</id>
		<title>class-design-pattern</title>
		<link rel="alternate" type="text/html" href="https://microformats.org/wiki/index.php?title=class-design-pattern&amp;diff=17895"/>
		<updated>2007-06-23T23:59:15Z</updated>

		<summary type="html">&lt;p&gt;SqrY0r: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;lt;h1&amp;gt; Class design pattern &amp;lt;/h1&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Purpose ==&lt;br /&gt;
Use the [[class-design-pattern]] to indicate semantic meaning about XHTML elements.  See the discussion of [[semantic-class-names]] for background.&lt;br /&gt;
&lt;br /&gt;
== How to use it ==&lt;br /&gt;
* always use the most appropriately [[semantic-xhtml|semantic (X)HTML]] element for the content. if an appropriate semantic element is not available, use &amp;lt;code&amp;gt;span&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;div&amp;lt;/code&amp;gt;. always avoid [[presentational-xhtml|presentational (X)HTML]].&lt;br /&gt;
* add semantics to (X)HTML by using [[semantic-class-names]].  The &amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt; attribute is a space separated list of class names.&lt;br /&gt;
* always choose names following the [[naming-principles|microformats naming principles]].&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
This is one of the most frequently occurring design patterns in microformats. Semantic meaning can be indicated on XHTML content by using the &amp;lt;code&amp;gt;class&amp;lt;/code&amp;gt; attribute of an enclosing element. For example, [[hcard|hCard]] adds information indicating that certain elements represent vCard person or organization, its URL, Formatted Name, and Organization by the class design pattern:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&amp;lt;nowiki&amp;gt;&lt;br /&gt;
&amp;lt;div class=&amp;quot;vcard&amp;quot;&amp;gt;&lt;br /&gt;
 &amp;lt;a class=&amp;quot;url fn&amp;quot; href=&amp;quot;http://tantek.com/&amp;quot;&amp;gt;Tantek Çelik&amp;lt;/a&amp;gt;,&lt;br /&gt;
 &amp;lt;span class=&amp;quot;org&amp;quot;&amp;gt;Technorati&amp;lt;/span&amp;gt;&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;/nowiki&amp;gt;&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in particular:&lt;br /&gt;
&lt;br /&gt;
* the section of the XHTML document that the microformat is being applied to is defined by &amp;lt;code&amp;gt;class=&amp;quot;vcard&amp;quot;&amp;lt;/code&amp;gt;. This is very common among non-trivial microformats.&lt;br /&gt;
* the use of both inline (&lt;/div&gt;</summary>
		<author><name>SqrY0r</name></author>
	</entry>
</feed>