< p > The item price is < span class=???cost??? > $ 100.00 < /span > . < /p >
In the preceding example, the currency value is marked with a class attribute with value cost .
A class has been used because the cost value can be used more than once to mark various elements in
the same document. An important consideration is that block elements can contain other block elements
or inline elements, whereas inline elements can contain only other inline elements.
The div and span elements should be used to add semantic value to a text. Quite often those elements
are used with the sole purpose of marking the document for formatting reasons; this practice must
be avoided as much as possible: The semantic structure is almost always good enough to define suitable
areas to be formatted and to apply visual effects to.
The div and span elements are not the only way to define block and inline sections but they are dealt
separately because they do not provide any additional semantic. A p element is a block - type element
with the additional semantic of representing a paragraph.
Pages:
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076