In below code how do I do vertical center element span with class "ExclamationPoint" ? I want to design it like below picture :
I tried Padding-top and vertical; align but I co开发者_Python百科uldn't style like image I want to position span with class "ExclamationPoint" vertically middle regardless the height of side DIV.JSFiddle Link
You can force it to the middle of the div like so:
First make sure the parent div (NewsNote
) has a position
set, so add position:relative;
.
Now, you can center .ExclamationPoint
by giving it a height
of 0
, position:absolute;
and top:50%;
. This will push the div down to the exact middle.
Now the exclamation point will be below the center, to fix this add line-height:0;
.
http://jsfiddle.net/vNDUx/1/
精彩评论