Welcome! » Log In » Create A New Profile

Limit width of table is it possible?

Posted by Luka 
Luka
Limit width of table is it possible?
April 19, 2012 12:33PM

Hi,

I am trying to use HTMlPurifier the first time, since I have got CKEditor included on my page.

I am allowing to add a table, but want to limit the max. width of this table. Is there a chance? I have tried the below, but this does not seem to work and I can still add a table with the width of 900px

$config->set('HTML.Allowed', table[width<600|cellpadding|cellspacing|border]);

I can't find a solution, any idea?

Re: Limit width of table is it possible?
April 19, 2012 01:06PM

Sorry, HTML Purifier doesn't have this functionality. I'm not even sure what it would mean.

Luka
Re: Limit width of table is it possible?
April 20, 2012 08:57AM

Oh, okay, thank you very much. I suppose it's also not possible to set a max. Font size, since I don't seem to find anything about that aswell. Is this correct?

Re: Limit width of table is it possible?
April 20, 2012 01:00PM

Yep, no such knob for that, although that is possibly implementable, using a mechanism similar to how we protect against imagecrash.

Re: Limit width of table is it possible?
April 01, 2013 12:46PM

It would be nice to be able to have this feature. It could prevent people from using table width="1000" and breaking your page layout.

Simply throwing an additional config setting such as:

$config->set('HTML.MaxTableWidth', '600');

Re: Limit width of table is it possible?
April 01, 2013 04:50PM

why not use CSS?

set the max-width of that table or div

div.content-table {
    max-width: 600px !important;
}

that way if some uses width greater than 600px inside that div element max-width will reduce it to max of 600px;

ImpressCMS: Make A Lasting Impression

Re: Limit width of table is it possible?
April 01, 2013 09:15PM
Re: Limit width of table is it possible?
April 02, 2013 02:03PM

http://jsfiddle.net/am4FV/12/

.content {
    max-width: 600px !important;
	border:1px solid #444;
}
.content table {
    max-width: 594px !important;
    border: 3px solid #cecece; /* careful of borders & padding */
    display: block;
}

ImpressCMS: Make A Lasting Impression

Author:
Your Email:

Subject:

HTML input is enabled. Make sure you escape all HTML and angled brackets with &lt; and &gt;.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

<pre><![CDATA[
Place code here
]]></pre>

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}

Message: