• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 11. Stylin' with Style Sheets > Redefining an HTML Tag

Redefining an HTML Tag

You can add attributes to any HTML tag you use. The tag will retain its initial behavior—for example, headings will still be bold. For now, let's modify the <h2> tag. You can follow these steps for any tag you want to modify.

To redefine a tag:

On your page, type some words, then select them and apply the Heading 2 format using the Property inspector (Figure 11.17).

Figure 11.17. For our example, type a few words in the Document window and then apply the Heading 2 style using the Property inspector.

On the CSS Styles panel, click on the New CSS Style button . The New CSS Style dialog box will appear.

Click on the Redefine HTML tag radio button.

The currently selected tag usually shows up selected in the tag menu; if it isn't, just select h2 from the menu (Figure 11.18). You can also type the tag in the text box, without any <angle brackets>.

Figure 11.18. Choose an HTML tag, from a to var, from the drop-down menu. The menu doubles as a text box where you can type any HTML tag. For our example, type h2 to redefine that tag, no brackets needed.

For now, let's save our style just in this document. Click on the This Document Only radio button. (To use an external style sheet, use steps 5 through 7 in the next section, Creating a Style Class.)

Click OK. The CSS Style Definition dialog box will appear.

The Type panel of the dialog box should be visible. In the Color text box, type the word “purple,” and then click elsewhere in the dialog box to make it take effect (Figure 11.19). Then, under Decoration, select line-through.

Figure 11.19. I made my selections in the CSS Style Definition dialog box. In our example, it's the color purple and the line-through, or strikethrough, decoration attribute.

Click OK to save your changes and close the CSS Style Definition dialog box.

The text you made into an H2 in step 1 will now be purple (Figure 11.20). Type the word “cold,” and then make it an H2. Watch the text change.

Figure 11.20. Now all the text that uses the <h2> tag is also purple and struck out. You can see in the Tag selector that no additional tags have been applied—it's just the <h2> tag, redefined.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint