Welcome! » Log In » Create A New Profile

CSS properties top and bottom.

Posted by Zachary Rosenthal 
Zachary Rosenthal
CSS properties top and bottom.
March 20, 2017 03:57PM

Hello, I am using Katex to allow users to enter mathematical formulas into my website forum. Katex uses css properties top and bottom to help display the formulas. I have noticed that HTMLPurifier strips these out.

<p style="top: 50px">Hello World!</p>

results in

<p>Hello World!</p>

while something like

<p style="color: red">Hello World!</p>

displays perfectly. (you can check both of these on the sites demo page)

I have two questions

1) Why are the top and bottom css properties stripped out?

2) How can I go about allowing them?

Thank you!

Re: CSS properties top and bottom.
March 20, 2017 04:09PM

By default, we don't enable absolute position elements, because they can be used to phish trusted UI elements on the page. They can be enabled with %CSS.Trusted but be careful!

Zachary Rosenthal
Re: CSS properties top and bottom.
March 20, 2017 04:14PM

Thank you for the quick response!

Is it possible to only enable a few of the css properties?

Re: CSS properties top and bottom.
March 20, 2017 04:19PM

Not really sorry. %CSS.AllowedProperties might help.

Your Email:


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:

Place code here

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}