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

Lesson 2. Upgrading to XHTML > Stripping Unwanted Tags

Stripping Unwanted Tags

As you know by now, the <font> tag has become obsolete, but unlike the <b> and <i> tags, it has no easy counterpart with which you can replace it. The presentation details that the <font> tag was once used to specify are now handled with an entirely new technology: CSS. Thus, rather than a one-to-one fix as you did in the previous task, solving this problem requires two steps. First, you need to strip out all of the old tags. Second, you need to develop and apply CSS. You'll do the first of these two steps in this task. The second step forms the basis of Lesson 3.

Stripping out <font> tags might seem difficult. After all, given their many attributes, and the many possible values you can enter in the attributes, you can't just do a search for the <font> tag as you can with the <b> tag. You need to find a way to catch differences like the ones between <font color="#00FF00"> and <font size="+1">. Two workarounds to this issue spring to mind. You could search for the string “<font” without the closing “>,” and then manually delete each instance. Alternatively, you could use regular expressions to construct a search for the font tag that includes any possible variation of attributes and their values.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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