Change font size from SQL

Andy Green
Andy Green used Ask the Experts™

I'm storing html in a database field. Users can edit the html, and see a the first part of the document in a preview box.

If users use a large font size (60 & above) if distoys the preview. How would I remove the users font size, and replace it with a default on, for the purpose of preview.

I cant use Replace in the SQL, as I'd need one for every font size. What I want to do is replace any font-size tag with font-size = "12px".

Could I use a regular expression for this? I do have access to the item databound event in the aspx page.

If so what would the expression lok like?


Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

You could use a regular expression, the following regular-expression assumes the size is declared using a properly formed CSS tag:

Open in new window

My bad that expression is incorrect, try this insted:

Open in new window

Most Valuable Expert 2012
Top Expert 2014

You can try adding following css in html when previewing

body * {
   font-size: 12px


This worked great. Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial