<p>How would you programmacially abbreviate <code>XHTML</code> to an arbitrary number of words without leaving unclosed or corrupted tags?</p>

<p>i.e.</p>

<pre><code>&lt;p&gt;
    Proin tristique dapibus neque. Nam eget purus sit amet leo
    tincidunt accumsan.
&lt;/p&gt;
&lt;p&gt;
    Proin semper, orci at mattis blandit, augue justo blandit nulla.
    &lt;span&gt;Quisque ante congue justo&lt;/span&gt;, ultrices aliquet, mattis eget,
    hendrerit, &lt;em&gt;justo&lt;/em&gt;.
&lt;/p&gt;
</code></pre>

<p>Abbreviated to 25 words would be:</p>

<pre><code>&lt;p&gt;
    Proin tristique dapibus neque. Nam eget purus sit amet leo
    tincidunt accumsan.
&lt;/p&gt;
&lt;p&gt;
    Proin semper, orci at mattis blandit, augue justo blandit nulla.
    &lt;span&gt;Quisque ante congue...&lt;/span&gt;
&lt;/p&gt;
</code></pre>

[{'answer_id': 34432, 'author': 'Rob Cooper', 'author_id': 832, 'author_profile': 'https://Stackoverflow.com/users/832', 'pm_score': 0, 'selected': False, 'text': '<p>If you are creating composite UserControl, then you can set the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.cssclass.aspx" rel="nofollow noreferrer">CSSClass</a> property on the child controls..</p>\n\n<p>If not, then you need to expose properties that are either of the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.cssclass.aspx" rel="nofollow noreferrer">Style</a> type, or (as I often do) string properties that apply CSS at the render type (i.e. take them properties and add a <em>style</em> attribute to the HTML tags when rendering).</p>\n'}, {'answer_id': 34502, 'author': 'Adam Lassek', 'author_id': 1249, 'author_profile': 'https://Stackoverflow.com/users/1249', 'pm_score': 7, 'selected': True, 'text': '<p>Here\'s what I did:</p>\n\n<pre><code>&lt;link rel="Stylesheet" type="text/css" href="Stylesheet.css" id="style" runat="server" visible="false" /&gt;\n</code></pre>\n\n<p>It fools Visual Studio into thinking you\'ve added a stylesheet to the page but it doesn\'t get rendered.</p>\n\n<hr>\n\n<p>Here\'s an even more concise way to do this with multiple references;</p>\n\n<pre><code>&lt;% if (false) { %&gt;\n    &lt;link rel="Stylesheet" type="text/css" href="Stylesheet.css" /&gt;\n    &lt;script type="text/javascript" src="js/jquery-1.2.6.js" /&gt;\n&lt;% } %&gt;\n</code></pre>\n\n<p>As seen in <a href="http://haacked.com/archive/2008/11/21/combining-jquery-form-validation-and-ajax-submission-with-asp.net.aspx" rel="noreferrer">this blog post</a> from Phil Haack.</p>\n'}, {'answer_id': 9953418, 'author': 'Kirtish Srivastava', 'author_id': 1304634, 'author_profile': 'https://Stackoverflow.com/users/1304634', 'pm_score': -1, 'selected': False, 'text': '<p>You Can use <code>CSS</code> direct in <code>userControl</code>.</p>\n\n<p>Use this in <code>UserControl</code>:</p>\n\n<pre><code> &lt;head&gt;\n    &lt;title&gt;&lt;/title&gt; \n    &lt;style type="text/css"&gt;\n      .wrapper {\n          margin: 0 auto -142px; \n         /* the bottom margin is the negative value of the footer\'s height */ \n       }\n    &lt;/style&gt;\n &lt;/head&gt;\n</code></pre>\n\n<p>This will work.</p>\n'}, {'answer_id': 14774992, 'author': 'Abdul Saboor', 'author_id': 1176903, 'author_profile': 'https://Stackoverflow.com/users/1176903', 'pm_score': 2, 'selected': False, 'text': '<p>Add the style on your usercontrol and import css in it.</p>\n\n<pre><code> &lt;%@ Control Language="vb" AutoEventWireup="false" CodeBehind="WCReportCalendar.ascx.vb"\nInherits="Intra.WCReportCalender" %&gt;\n &lt;style type=\'text/css\'&gt;    \n      @import url("path of file.css");\n       // This is how i used jqueryui css\n      @import url("http://code.jquery.com/ui/1.10.0/themes/base/jquery-ui.css");               \n\n &lt;/style&gt;\n\n your html \n</code></pre>\n'}]
['https://Stackoverflow.com/questions/34394', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3187/']