The s html tag
The <s> HTML tag is mainly used to style text it has the same functionality as the <strike> HTML tag. By default it displays text as with a strike-through line through it which is ideal for showing corrections or previous amended text. It works equally as well in table based layouts as well as CSS based ones. As with all phrase based HTML tags it can be used in situations where consistency between browsers is difficult to achieve in other ways. When text is put between the opening and closing <s> tag it is displayed as a strike through text.
<s>Some strike through text in here</s>
Any text between the opening and closing tag will be displayed as strike through text.
It is possible to style and add functionality to the <s> tag, this is done by adding an attribute to after the strike in the opening <s> tag
Attributes allowed for the <s>tag include :-class, dir, id, lang, style and title.
In most cases class and id are used and its basic usage is shown below
<s id=”header”>Some strike through text</s>
With all attributes there is a space after the initial strike then the attribute name, then an equal’s sign and the identifier of the attribute in double quotes.
Both id and class attributes refer to CSS styling of the element and is either stored in the <head> of the webpage on in an external file.
With id this usually refers to a single instance on a page where as class usually refers to a repeating element on a page, it is for this reason for the <s> tag may use either the id or class as an attribute.
The attribute style allows you to include CSS style information for a single <s> tag.
The dir attribute allows for left reading and right reading text, lang allows you to specify a language for the tag and title allows you to include extra information for a tag.
<s>Some strike through text</s> – basic usage example.
<s id=”header”>Some strike through text</s> – strike through text which is styled by the id header.
<s class=”header”> Some strike through text </s> – strike through text which is styled by the class header.
<s id =”header” class=”header”> Some strike through text </s> – strike through text which is styled by the class header and the id header.
<s style=”color:#F00;”>Some strike through text</s> – strike through text which has a custom colour of red.
<s dir=”rtl”>Some strike through text</s> – strike through text where the text reads from right to left.
<s lang=”uk”>Some strike through text</s> – strike through text where the language has been tagged as UK.
<s title=”title”>Some strike through text</s> – strike through text where the tag has been titled title.
Touching on just the surface of the <s> HTML tag it is easy to see how versatile it is. To take full advantage of it an understanding of CSS is an advantage.