Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1034929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:28:07+00:00 2026-05-16T14:28:07+00:00

I have an inline markup editor built into my website, which should produce XHTML

  • 0

I have an inline markup editor built into my website, which should produce XHTML compliant markup. But as you can see, it uses the deprecated font tag and size attribute.

<font style="font-family: Courier New; color: rgb(0, 0, 153);" size="2">
   asdfa
   <span style="color: rgb(0, 51, 0);">
    a
    <font size="5">fds</font>
   </span>
</font>

On other browsers, it produces the <span class="Apple-style-span" style="font-size: xx-large;"> instead of <font size="5">

Is there a Javascript/Regex solution to taking the first set of markup and replacing it with XHTML compliant markup using style attribute and span tag.
Thanks in advance!!

(ps. jQuery can be used too)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T14:28:07+00:00Added an answer on May 16, 2026 at 2:28 pm

    The markup above is perfectly valid in XHTML 1.0 Transitional.

    Whether deprecated elements like <font> are used are a completely orthogonal issue to whether XHTML or HTML syntax is used. XHTML 1.0 is nothing more or less than a restating of HTML 4.01 in XML syntax: consequently there are Transitional and Strict variants just as there are for HTML 4.

    <font size="5"> and <span class="Apple-style-span" style="font-size: xx-large;"> are semantically equally useless. If you want markup to use a set of defined elements and classes that are meaningful in the context of your site, you’ll have to hack the editor into using those, instead of being based purely on visual formatting.

    You could parse the XHTML and alter it as a later step, to try to make it look better. But regex is not at all an adequate tool to do so, as previously mentioned. You would need an XML parser, then you’d fix up the elements and attributes, then re-serialise it to XHTML. It would be sensible to do this on the server-side, because getting an XML parser on the client-side is slightly tricky, and you will need to do it on the server side anyway if you’re going to be cleaning non-whitelisted elements and attributes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I have textboxes, dropdownlists and submit buttons. They are all inline-elements. Which means
LINQ simplifies database programming no doubt, but does it have a downside? Inline SQL
I have the following markup with inline javascript and would like to change it
I have markup language which is similar to markdown and the one used by
i have a input tag which is non editable, but some times i need
I have nearly 100 HTML files that uses the <tt> tag to markup inline
I have a import directive in my inline .aspx page (no code-behind). Getting an
The marketing people want to have the ability to write direct inline HTML in
I am using VB9's inline XML, and I have a need to specify a
Assume I have a function template like this: template<class T> inline void doStuff(T* arr)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.