css - Display table and table-cell bug in Chrome -
html
<div class="circle"> <div class="content"> <span><h3>heading</h3><p>slogan goes here</p></span> </div> </div>
css
.circle { position: relative; width: 0; height: 0; padding: 20%; margin: 1em auto; border-radius: 50%; background: #a7cd80; } .content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: table; overflow: hidden; } .content span{ display: table-cell; vertical-align: middle; text-align: center; } h3{ line-height: 1px; }
this code working in firefox not in chrome etc. text displaying table-cell in firefox not in others text centered horizontally , vertically in circle in firefox.
you see visually
it because have given .circle
width , height of 0, means there no space inside object , when give width , height of span 100%, it's actual width , height 0
if give circle actual width , height instead of making shape using padding should work
Comments
Post a Comment