Solved

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

Posted on 2008-06-26
6
311 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

738 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