Let's say that I have a div in an html document with an absolute position, like so:
<div style=position:absolute>Hello!</div>
Now let's say I want to give it an X and a Y (likely through JQuery, for my purposes). This is easy enough, just set the left and top properties to X and Y respectively.
This task, however, gets a great deal harder when the X and Y are to be the center of this div. If the size of the div is not always guaranteed to be the same, you can't just offset the X and Y to the approprate amount.
If it is possible, how does one set the center of a div to a specific X and Y? In case it helps, these divs will only ever contain text, no sub elements.
I would prefer to use CSS rather than JavaScript, but if that is necessary, I'd be okay with it.