Solved

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

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
Any business that wants to seriously grow needs to keep the needs and desires of an international audience of their websites in mind. Making a website friendly to international users isn’t prohibitively expensive and can provide an incredible return…
The viewer will learn how to dynamically set the form action using jQuery.
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…

706 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

19 Experts available now in Live!

Get 1:1 Help Now