Solved

How can I apply CSS to badly written HTML???

Posted on 2008-06-26
6
290 Views
Last Modified: 2013-12-25
Is there a way, on my Style Sheet, to tell the browser to apply my CSS styles to HTML that is badly formed??

I have a client who must, at times, write and post his own HTML. Unfortunately the best description of his code is "WIlly Nilly" ! Biggest problem is lack of use of <p> tags, closing tags, using closing tags where opening tags should be.

So how can I specify in CSS that "Willy Nilly" text (OK -- text with paragraph tags around it) will be formatted the same as I specify for <p> tags??



0
Comment
Question by:Spitfire6
  • 3
  • 2
6 Comments
 
LVL 2

Expert Comment

by:JurgenvH
ID: 21877936
You could search the posted (Willy Nilly) text for new lines and explode on every double new line. Each array element of the result can then be saved with paragraph-tags around it.
0
 

Author Comment

by:Spitfire6
ID: 21878111
Thanks for the response JurgenVH! That would seem very complicated. I have thought about writing a routine that would solve on of this guy's other bad habits, That of including mile long text links ("link text" ??) that causes Mozilla browsers to widen out.

But, There has to be a CSS specification that will apply a style to what is essentially text not enclosed in an HTML tag.

I just fooled around with the code attached added to my style sheet. Caused everything on a correctly written page to go Gigantic. I think it applied the style below IN ADDITION TO the style specified -- resulting in increased text sixe.
*P{font-family: "Franklin Gothic Medium";
	font-size: 105%;
	font-weight: normal;
	color: #000000;}

Open in new window

0
 
LVL 2

Expert Comment

by:JurgenvH
ID: 21878895
And the asterix declarations work in other browsers than IE?
0
 

Author Comment

by:Spitfire6
ID: 21879104
Please note that the "P" after the asterisk was a typo.

No, the same thing happed in Firefox.
0
 
LVL 2

Accepted Solution

by:
JurgenvH earned 50 total points
ID: 21881589
Sorry, didin't get the typo...
I never heard of the asterix as declaration of its own but probably its some kind of default for unstyled text or body text because only my bodytext gets supersized.
So I you could use it but since it is a default you'd have to catch all you Willy Nilly text with that same declaration.
If you don't want that, my first solution is still a possibility...
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question