treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Vertically center something in an auto-height div..

  • I want to vertically center the X in the anchor which is 100% height of it's parent, so it's dynamic.
    Anybody know how I can do this?

    I feel like an idiot.

    <a href="" class="suborder_item_remove"><span>X</span></a>


    .suborder_item_remove {
    background:url(../images/suborder_item_remove.gif) repeat-y;
    color:#454545; /*Dark Grey */
    float:left;
    line-height:100%;
    position:absolute;
    top:0;
    right:0;
    text-align:center;
    text-decoration:none;
    width:17px; height:100%;
    }
    .suborder_item_remove span {
    display:block;
    height:100%;
    }


    Figured it out, heh.