Skip to content

Instantly share code, notes, and snippets.

@kazimolmez
Created September 8, 2018 08:30
Show Gist options
  • Save kazimolmez/e446d39ba290cc85530c4e35cfb6a86e to your computer and use it in GitHub Desktop.
Save kazimolmez/e446d39ba290cc85530c4e35cfb6a86e to your computer and use it in GitHub Desktop.
Responsive Circle
<div class="circle">
<div class="content">
<span>Centered text</span>
</div>
</div>
<style>
html {
font: 300 100%/1.5 Ubuntu;
color: #333;
}
.circle {
position: relative;
width: 100%;
height: 0;
padding: 50% 0;
margin: 1em auto;
border-radius: 50%;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
}
.content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
text-align: center;
}
.content:before {
content: '';
vertical-align: middle;
display: inline-block;
width: 0;
height: 100%;
}
.content span {
vertical-align: middle;
display: inline-block;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment