Ellipsis on long text in the table.

Sometimes you would like to shorten your long text in the HTML table. Here is the way to go with css and jQuery: css:

<table>
  <tr>
    <td class="ellipsis">
      Some very long text that you would like to be shortened
    </td>
  </tr>
</table>

CSS:

td.ellipsis {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px
}

jQuery:

$('.ellipsis').each(function (index) {
    var $this = $(this);
    var titleVal = $this.text();
    if (titleVal != '') {
        $this.attr('title', $.trim(titleVal));
    }
});

Center Div in CSS

I hate CSS with passion. How many fucking steps do you need to take to make things aligned in the center of a container?
You need to make sure your outside container is set to the required width. Usually 100%.
Then you need to center the loose text by text-align:center;
Then you need to make internal container to have set width (sic!) and give it margins to “auto”.

I understand the concept behind this. But show me a man who came up with idea of setting a margin to auto to be align a container. I’ll shoot him in a face!

blah-bloody-blah! this is centered with no problem.
and this just does not get into center unless you set margins.
blah-bloody-blah! this is centered with no problem.

and this just does not get into center
unless you set margins.