Getting the same div is the work of width not display . When you use text-align this property applies to all children of an element.
For example, in
<div> <span>Text</span> Text </div> span { text-align: center; }
This will apply to the text, not the range. This way you get the text centered, but the range will still be in its own location, left and just below the previous default element.
To check if text-align is applied or not, you can try checking the property of the child in the Developer Tools.
Jsfiddle for this: http://jsfiddle.net/afzaal_ahmad_zeeshan/eKrNt/
You can see that the property has been applied to the div , but instead. It was a child who was aligned with the center.
Your code:
#div1 { position: relative; bottom: 10px; left: auto; text-decoration: overline underline; display: inline; text-align: center; }
This is a clear answer, you align the text inside this div to the center.
And the mouseover event should be somewhere in the function or script. Which is caused by a hover event or the same.
Afzaal ahmad zeeshan
source share