javascript - How to place Svg Circle into middle of the page -
i'm trying place large svg circle middle of page - horizontally , vertically. not working, tips?
here code - using jade , scss:
jade:
.logo svg.logo__svg circle( r=300 style="fill:none;stroke:white;stroke-width:1;")
scss:
.logo{ height: 80%; width: 80%; position: relative; top: 50%; left: 50%; transform: translate(-50%, -50%); @include element('svg'){ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); height: 100%; width: 100%; } }
you have many offsets , transforms.
body { margin: 0; background-color: rebeccapurple; } .logo { width: 100vw; height: 100vh; position: relative; } .logo__svg { width: 402px; height: 402px; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
<div class="logo"> <svg class="logo__svg"> <circle cx="50%" cy="50%" r="200" style="fill:none;stroke:white;stroke-width:1;"/> </svg> </div>
Comments
Post a Comment