HTML Text Level Semantic Styles - CSS Lib | CSS: Presentation Layer
Standards Based Development
css Library - html Text-Level Semantics
- The
aelement - The
emelement - The
strongelement - The
smallelement - The
selement - The
citeelement - The
qelement - The
dfnelement - The
abbrelement - The
dataelement - The
timeelement - The
codeelement - The
varelement - The
sampelement - The
kbdelement - The
sub/supelements - The
ielement - The
belement - The
uelement - The
markelement - The
rubyelement - The
rtelement - The
rpelement - The
bdielement - The
bdoelement - The
spanelement - The
br /element - The
wbrelement
| Element | Purpose | Example |
|---|---|---|
a | Hyperlinks | Visit my |
em | Stress emphasis | I must say I |
strong | Importance | This tea is |
small | Side comments | These grapes are made into wine. |
s | Inaccurate text | Price: |
cite | Titles of works | The case |
q | Quotations | The judge said |
dfn | Defining instance | The term |
abbr | Abbreviations | Organic food in Ireland is certified by the |
data | Machine-readable equivalent | Available starting today! |
time | Machine-readable equivalent of date- or time-related data | Available starting on |
code | Computer code | The |
var | Variables | If there are |
samp | Computer output | The computer said |
kbd | User input | Hit |
sub | Subscripts | Water is H |
sup | Superscripts | The Hydrogen in heavy water is usually |
i | Alternative voice | Lemonade consists primarily of |
b | Keywords | Take a |
u | Annotations | The mixture of apple juice and |
mark | Highlight | Elderflower cordial, with one |
ruby, rt, rp | Ruby annotations |
|
bdi | Text directionality isolation | The recommended restaurant is |
bdo | Text directionality formatting | The proposal is to write English, but in reverse order. "Juice" would become " |
span | Other | In French we call it |
br / | Line break | Simply Orange Juice Company |
wbr | Line breaking opportunity | www.simply |
Using code, kbd, samp and pre
Combine pre with code to represent a block of computer code.
Combine pre with samp to represent a block of computer output.
Combine pre with kbd to represent input the user is to enter.
Styling pre and code Elements Demo
Using kbd and samp Together
Combining samp and kbd
samp and pre can be used together when representing input based on system output or input that is echoed by the system. In the following example, the user is told which menu item to choose in order to save an image:
To save the image file, select File - Save as....
<p>
To save the image file, select
<kbd>
<kbd>
<samp>File</samp>
</kbd>
- <kbd>
<samp>Save as...</samp>
</kbd>
</kbd>
.</p>
Above, the menu item represent output from an unspecified program, therefore each menu item is sample output and gets a samp. The samp element is nested within kbd because it is user input, and then it all gets nested within another kbd to represent the entire user input block.
Describing how code echoes instructions in a modal/window is an example where samp is the parent and kbd(s) are nested within:
A message will appear on the screen informing you what to do next: Press Enter to continue.
<p>
A message will appear on the screen informing you what to do next:
<samp>
Press
<kbd>Enter</kbd>
to continue
</samp>.
</p>
Combining samp, kbd, and pre
samp, kbd, and pre can be used in conjunction, where pre is the parent. This is very useful for displaying code; the example below represents screen output for changing a directory at the Windows command prompt:
C:\> cd html5 + Enter C:\html5>
<pre><samp>C:\></samp>
<kbd><kbd>cd html5</kbd> +
<kbd>Enter</kbd></kbd>
<samp>C:\html5></samp></pre>
Using HTML's kbd, samp, and pre elements
This second example shows a block of sample output. Nested samp and kbd elements allow for the styling of elements of the sample output using a style sheet.
jdoe@mowmow:~$ ssh demo.example.com Last login: Tue Apr 12 09:10:17 2005 from mowmow.example.com on pts/1 Linux demo 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189 #1 SMP Tue Feb 1 11:22:36 PST 2005 i686 unknown jdoe@demo:~$ _
<pre><samp><span class="prompt">jdoe@mowmow:~$</span> <kbd>ssh demo.example.com</kbd>
Last login: Tue Apr 12 09:10:17 2005 from mowmow.example.com on pts/1
Linux demo 2.6.10-grsec+gg3+e+fhs6b+nfs+gr0501+++p3+c4a+gr2b-reslog-v6.189 #1 SMP Tue Feb 1 11:22:36 PST 2005 i686 unknown
<span class="prompt">jdoe@demo:~$</span> <span class="cursor">_</span></samp></pre>