jQuery - Margin left minus half of the div's width
I want to achieve something like this:
I have a div, which width is not specified, so it changes basing on the
content it has. First of all, I want to calculate that div's width. After
that, I would like to add css style with jquery, which will margin that
div left half of its width. So, if the div's width is 300px, I want this
css added to the same div:
margin-left: -150px;
I hope I was clear. Thanks a lot.
No comments:
Post a Comment