I have a div and I want if the text is sort (below 100 characters for example) to set it at the centre of this div.
How can I do that?
What do you mean by "centre"? Vertically? Horizontally? Both? It's hard to help you without some sample HTML.
I think he wants the text to be horizontally centered, but only if the text is short enough to fit on one line, that 100 characters he was mentioning.
It should only mean scripting the setting of a class name to the appropriate element.