Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the ie equivalent of -moz-fit-content and -moz-center

Tags:

css

I am trying to center align link elements one below the other, inside a parent element where the elements take the minimum width and height like when using display:inline-block

.parent {
    text-align: -moz-center;
    text-align: -webkit-center;
    text-align: -ms-center;
}

.parent a {
    display:block;
    width:-moz-fit-content;
    width:-webkit-fit-content;
    width:-ms-fit-content;
    background-color:red;

}


<div class="parent">
  <a href ="#">Link1</a>
  <a href="#">Link2</a>
</div>

I see that it works for Chrome and Firefox but does not work for IE. Does anyone know what is the equivalent of -moz-center and -moz-fit-content in IE ?

like image 819
Anonymous Avatar asked Feb 12 '23 21:02

Anonymous


1 Answers

Why not just use actual inline-block for the container? Also, display:table and float:left will have the same effect.

.parent {
  display: inline-block;
  background: #eee;
}
.parent a {
  display: block;  
  text-align: center;
}
<div class="parent">
  <a href ="#">Link1 is long</a>
  <a href="#">Link2</a>
</div>
like image 193
Ilya Streltsyn Avatar answered May 19 '23 18:05

Ilya Streltsyn