Solved

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

Posted on 2008-06-26
6
276 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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now