I wanted to recreate something like this:
And then I would use it for social medias and external sites :) This is what I could come up with:
As you can see, there are two problems here:
- The picture doesn't fit the div.
- The text isn't in the middle.
I thought if I could align the text to the center, the picture would automatically fit as well, but I can't seem to be able to do it.
Here's the code I wrote:
.child {
  height: 250px;
  margin: 20px;
}
.external-links {
  display: table-cell;
  background: #ccc;
  vertical-align: middle;
  text-align: center;
  border-radius: 32px;
  color: black;
  text-decoration: none;
  padding: 1px;
}<div class="child">
  <a class="external-links" href="https://github.com/amirashabani" target="_blank">
    <img src="{% static 'app/images/icons/github.ico' %}">
    <span>github</span>
  </a>
  <a class="external-links" href="https://twitter.com/amirashabani" target="_blank">
    <img src="{% static 'app/images/icons/twitter.ico' %}">
    <span>twitter</span>
  </a>
  <a class="external-links" href="https://stackoverflow.com/users/6282576/amir-a-shabani" target="_blank">
    <img src="{% static 'app/images/icons/stackoverflow.ico' %}">
    <span>stackoverflow</span>
  </a>
</div>I thought the two lines of vertical-align: middle; & text-align: center; would center the text, but it doesn't.


 
    
 
     
     
     
     
     
     
    