user4584963 user4584963 - 4 months ago 19
CSS Question

CSS glyphicon position bottom not working

I have a simple question that I can't seem to figure out the answer to. Why is bottom doing nothing in my example. The parent position is set to relative, the child is absolute, the parent also has a height. I can't seem to figure it out. I know I can just use top, but I was curious as to why bottom doesn't work here.



.profile-image-container {
position: relative;
height: 200px;
width: 200px;
background-color: yellow;
}

.profile-image-container .glyphicon {
position: absolute;
bottom: 50px;
}

<link href="http://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<div class="profile-image-container">
<i class="glyphicon glyphicon-pencil"></i>
</div>




Answer

The bootstrap.min.css has set the top property of the glyphicon class. So you need to set the top property to auto to override it.

.profile-image-container .glyphicon {
  position: absolute;
  bottom: 50px;
  top: auto;
}
Comments