Can you make a star path progress bar with transparent background? - html
So i'm making a website and i wanted to try add ratings to items but can't find a way to remove the white background off this path
using font awesome doesnt quite look how i wanted it to so i started looking into svg paths, i found some code that pretty much does what i want but cant figure out how to remove the white fill/background on it
* {
box-sizing: border-box;
}
.rating {
width: 120px;
height: 24px;
position: relative;
background-color: gray;
}
.rating progress.rating-bg {
-webkit-appearance: none;
-moz-appearence: none;
appearance: none;
border: none;
display: inline-block;
height: 24px;
width: 100%;
color: orange;
}
.rating progress.rating-bg::-webkit-progress-value {
background-color: orange;
}
.rating progress.rating-bg::-moz-progress-bar {
background-color: orange;
}
.rating svg {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
<svg style="display:none;">
<defs>
<symbol id="fivestars">
<path d="M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z M0 0 h24 v24 h-24 v-24" fill="white" fill-rule="evenodd"/>
<path d="M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z M0 0 h24 v24 h-24 v-24" fill="white" fill-rule="evenodd" transform="translate(24)"/>
<path d="M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z M0 0 h24 v24 h-24 v-24" fill="white" fill-rule="evenodd" transform="translate(48)"/>
<path d="M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z M0 0 h24 v24 h-24 v-24" fill="white" fill-rule="evenodd" transform="translate(72)"/>
<path d="M12 .587l3.668 7.568 8.332 1.151-6.064 5.828 1.48 8.279-7.416-3.967-7.417 3.967 1.481-8.279-6.064-5.828 8.332-1.151z M0 0 h24 v24 h-24 v-24" fill="white" fill-rule="evenodd" transform="translate(96)"/>
</symbol>
</defs>
</svg>
<div class="rating">
<!-- <div class="rating-bg" style="width: 90%;"></div> -->
<progress class="rating-bg" value="4.5" max="5"></progress>
<svg><use xlink:href="#fivestars"/></svg>
</div>
Related
How can I translate an element and at the same time rotate realistically?
It turns out of position and moves incorrectly. It's hard to find the exact point so it looks realistic and the transitions are smooth. the turning is out of cue and can not find a solution to make it turn faster as it moves at its normal rate. I have tried many times to get the exact timing but I cant find a way. function wid() { if (window.innerWidth < 960) { var r = document.querySelector(':root'); r.style.setProperty('--wid', '100%'); } wid(); } #car { background-color: transparent; width: 10px; height: 20px; transform: translate(241.5px, 215px); position: relative; animation-name: driving; animation-duration: 10s; animation-timing-function: linear; /*linear ease-in-out*/ } #map { background-color: transparent; width: 400px; margin: auto; position: absolute; transform: translate(5%, 5%); } #bod { background-color: green; position: absolute; width: 100%; height: 100%; } html, body { margin: 0px; padding: 0px; width: 100%; height: 100%; } .mainsec {} #keyframes driving { 0% { transform: translate(241.5px, 215px); } 10% { transform: translate(241.5px, 40px)rotate(-60deg); } 28% { transform: translate(41.5px, 86px)rotate(-125deg); } 38% { transform: translate(41.5px, 300px)rotate(-180deg); } 40% { transform: translate(120px, 360px)rotate(-220deg); } 50% { transform: translate(160px, 360px)rotate(-125deg); } 60% { transform: translate(200px, 450px)rotate(-230deg); } 70% { transform: translate(400px, 460px)rotate(-360deg); } 80% { transform: translate(260.5px, 215pxrotate(360deg)); } 90% { transform: translate(241.5px, 180pxrotate(360deg)); } 100% { transform: translate(241.5px, 215pxrotate(360deg)); } } <div id="bod"> <div id="map"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="415.00774" height="464.03421" viewBox="0,0,415.00774,464.03421"> <g transform="translate(-5.56354,24.30861)"> <g data-paper-data="{"isPaintingLayer":true}" fill-rule="nonzero" stroke-width="0" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" style="mix-blend-mode: normal"> <path d="M193.21864,323.70241c2.08101,14.58763 -0.75936,39.6034 -0.75936,39.6034l-76.95053,-59.65507c0,0 27.04231,-21.9967 43.16349,-20.31537c5.01955,0.5235 15.96324,3.86994 22.75063,11.80093c6.7874,7.93099 11.43447,26.03343 11.79578,28.56611z" fill="#e2ea8f" stroke="none"/> <path d="M5.56688,290.21195c0.51544,-15.25718 8.62251,-39.2653 8.62251,-39.2653l75.02651,85.4148c0,0 -34.79132,12.85441 -52.63063,5.75382c-5.55452,-2.21087 -17.2321,-9.2315 -23.32635,-19.42903c-6.09425,-10.19755 -7.78154,-29.82536 -7.69204,-32.47428z" fill="#e2ea8f" stroke="none"/> <path d="M219.05583,250.34734v-212.80012c0,0 1.48764,-14.0667 -3.9272,-17.72172c-5.41484,-3.65502 -26.47434,-0.83576 -26.47434,-0.83576l-66.30684,14.95228c0,0 -31.54844,6.49453 -43.16799,13.0135c-11.85598,6.65162 -17.65815,11.05621 -23.81015,25.35199c-6.15201,14.29579 -4.49552,155.45874 -4.49552,155.45874c0,0 0.12847,18.24631 2.32244,26.68213c1.97899,7.60918 18.15757,34.8776 33.34816,40.17712c19.19535,6.69665 43.22077,-3.09306 62.42146,3.17404c13.17719,4.30105 19.38737,8.26387 26.48485,18.94892c8.15443,12.27627 12.12432,31.97154 14.43416,37.56194c3.22503,7.80536 6.42812,17.86233 6.42812,17.86233l3.4807,18.08984c0,0 1.03251,15.13972 8.75099,18.80522c6.38845,3.03387 114.48707,3.64998 151.55195,3.77223c7.71664,0.02545 10.45146,1.27859 12.93151,-2.85614c1.26925,-2.11608 1.73211,-6.23932 -2.62668,-9.76101c-4.15809,-3.35953 -50.05552,-4.44025 -50.05552,-4.44025l8.83274,-34.13795c0,0 28.4294,-1.70463 51.65944,4.28594c23.23005,5.99057 28.02805,8.6783 34.85366,27.38878c4.72033,16.40398 10.64834,45.16217 -7.11765,45.35982c-60.58922,0.67405 -196.5872,1.94573 -217.63794,0.05149c-6.61359,-0.59513 -10.36459,-4.25214 -10.90643,-5.25027c-2.18537,-4.02565 -3.47544,-7.21102 -4.98448,-12.09238c-1.50902,-4.88135 -11.88057,-53.84601 -20.93852,-71.76255c-6.71889,-13.2899 -21.01689,-13.36816 -21.01689,-13.36816l-36.99995,-0.31926c0,0 -24.73763,1.62251 -39.7364,-10.8668c-11.6551,-9.70507 -19.2506,-18.21353 -27.99162,-32.54346c-8.74102,-14.32992 -9.25637,-22.76613 -12.14607,-33.25777c-2.88029,-10.45743 -3.43264,-33.62966 -3.43264,-33.62966c0,0 2.31202,-92.96558 1.9462,-152.4744c-0.07076,-11.51164 3.51657,-14.76709 6.12168,-20.3207c3.4054,-7.25967 10.81182,-13.80213 10.81182,-13.80213c0,0 19.26399,-15.40827 29.93019,-21.31454c10.50848,-5.81894 33.60085,-13.86497 33.60085,-13.86497l94.80812,-23.31008c0,0 15.46605,-4.62962 28.36495,-4.85435c11.96737,-0.2085 21.24293,3.77639 25.88139,8.78947c2.73367,2.95445 8.45832,9.73142 10.28464,14.53415c4.2386,11.14628 2.66852,21.78451 2.66852,21.78451v229.54004c0,0 -1.40764,17.5481 -0.50008,26.82662c0.34086,3.48486 4.70635,31.95634 21.05493,49.25219c15.8564,16.77515 51.49572,35.54486 51.49572,35.54486l-8.29877,33.81234c0,0 -16.52481,-0.78157 -32.88652,-13.95939c-14.69724,-7.65388 -27.17248,-17.57315 -36.41394,-27.55132c-16.40866,-17.71676 -22.39766,-35.61914 -24.07827,-41.35593c-5.39145,-18.40375 -8.51881,-62.56938 -8.51881,-62.56938z" fill="#414141" stroke="#000000"/> <path d="M219.05583,165.09336v-5.97191h38.14575v5.97191z" fill="#d2d2d2" stroke="#000000"/> <path d="M224.72917,199.44555v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M240.9985,199.47883v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M224.72915,169.62976v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M240.99849,169.66305v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M224.72915,184.69724v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M240.9985,184.73053v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M224.73546,228.96504v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M241.00479,228.99833v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M224.73546,214.21673v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M241.00479,214.25002v-1.40716h10.52976v1.40716z" fill="#d2d2d2" stroke="#000000"/> <path d="M203.48125,23.23113l-0.09191,-5.49181c0,0 9.04848,-1.64122 13.01789,1.24562c2.86101,2.08074 4.05979,12.06922 4.05979,12.06922l-6.28979,0.0411c0,0 -0.42661,-5.56759 -3.14675,-7.23476c-2.27102,-1.39192 -7.54922,-0.62936 -7.54922,-0.62936z" fill="#bd0000" stroke="none"/> <path d="M207.96794,23.16086v-5.85189c0,0 2.70134,0.06002 4.01174,0.21819c1.25881,0.15192 3.70211,0.71279 3.70211,0.71279l-4.38891,5.71888c0,0 -1.13567,-0.40556 -1.69516,-0.53983c-0.5486,-0.13166 -1.62977,-0.25815 -1.62977,-0.25815z" fill="#bdbdbd" stroke="none"/><path d="M214.08583,31.1407l-0.66499,-3.85692l5.98488,-1.59597l0.93098,5.18691z" fill="#bdbdbd" stroke="none"/> </g> </g> </svg> </div> <div id="car"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="5.69151" height="13.00614" viewBox="0,0,5.69151,13.00614"> <g transform="translate(-237.15425,-173.49693)"> <g data-paper-data="{"isPaintingLayer":true}" fill-rule="nonzero" stroke-width="0" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="10" stroke-dasharray="" stroke-dashoffset="0" style="mix-blend-mode: normal"> <path d="M237.95271,176.91509v-0.36484h1.65836v0.36484z" fill="#7e7e7e" stroke="none"/><path d="M240.4616,177.96722l-0.10174,-0.19425l1.68345,-0.8818l0.10175,0.19425z" data-paper-data="{"index":null}" fill="#7e7e7e" stroke="none"/> <path d="M240.40631,176.94827v-0.36484h1.65836v0.36484z" data-paper-data="{"index":null}" fill="#7e7e7e" stroke="none"/> <path d="M237.87231,177.05225l0.10177,-0.19425l1.68345,0.8818l-0.10174,0.19425z" fill="#7e7e7e" stroke="none"/> <path d="M237.68777,185.93213l0.07908,-4.54285l0.04206,-0.67016l0.26596,-0.28733c0,0 0.87932,-0.26451 1.13707,-0.61548c0.38158,-0.51961 0.30716,-1.61303 0.30716,-1.61303l0.13902,-3.00375l-0.57115,-0.00965l-0.80751,0.2432l-0.79069,-0.00484v-1.58791h2.20561l0.33641,-0.34338l0.34463,0.34338h2.13582v1.58791l-0.66608,0.00627l-0.80156,-0.27803l-0.63165,-0.00276l0.13298,3.04754c0,0 -0.04796,1.08621 0.37004,1.67854c0.27203,0.38548 1.01745,0.57779 1.01745,0.57779c0,0 0.22801,0.19788 0.25867,0.29475c0.03066,0.09686 0.03601,0.63613 0.03601,0.63613l0.08511,4.54371z" fill="#000000" stroke="#000000"/> <path d="M237.15425,177.61095v-1.79988h0.82698v1.79988z" fill="#353535" stroke="none"/> <path d="M242.01878,177.65959v-1.79987h0.82697v1.79987z" fill="#353535" stroke="none"/> <path d="M237.15425,186.26759v-1.79987h1.0923v1.79987z" fill="#353535" stroke="none"/> <path d="M241.75344,186.31622v-1.79986h1.0923v1.79986z" fill="#353535" stroke="none"/> <path d="M238.35111,185.93798l0.0268,-1.54014l-0.65122,-0.69631l0.04014,-2.30639l0.04206,-0.67016l0.26596,-0.28734c0,0 0.87933,-0.26451 1.13708,-0.61549c0.38158,-0.51961 0.30716,-1.61302 0.30716,-1.61302l0.13902,-3.00375l0.03627,-1.35921l0.33641,-0.34338l0.34463,0.34338l0.03653,1.31338l0.13297,3.04753c0,0 -0.04796,1.08623 0.37004,1.67854c0.27203,0.38548 1.01745,0.57779 1.01745,0.57779c0,0 0.22801,0.19788 0.25867,0.29475c0.03066,0.09686 0.03602,0.63613 0.03602,0.63613l0.0426,2.27394l-0.64783,0.79572l0.06016,1.47404z" fill="#f30000" stroke="#000000"/> <path d="M238.82256,186.50307v-0.92868h2.35487v0.92868z" fill="#000000" stroke="none"/> <path d="M239.43365,180.99989v-1.46517c0,0 0.25408,-0.66824 0.56634,-0.65782c0.34514,0.01152 0.56635,0.65782 0.56635,0.65782v1.46517z" fill="#7e7e7e" stroke="none"/> <path d="M239.99999,180.68103c-0.17989,0 -0.32574,-0.16918 -0.32574,-0.37787c0,-0.20869 0.14583,-0.37787 0.32574,-0.37787c0.17989,0 0.32575,0.16918 0.32575,0.37787c0,0.20869 -0.14584,0.37787 -0.32575,0.37787z" fill="#f30000" stroke="none"/> </g> </g> </svg> </div> </div>
SVG property vector-effect="non-scaling-stroke" still scales stroke
In SVG, I need the PATH stroke width to remain as is while viewBox property is changing. The SVG property vector-effect="non-scaling-stroke" should accomplish that but it is not working as it suppose to. Can someone explain why in the code below (check the codepen.io) the stroke width still increases as viewbox changes? I would also appreciate a solution that makes strokes width constant regardless of viewbox. https://codepen.io/anon/pen/eKQrYL HTML <div class="Item"> <div class="Item-graphic"> <svg id='scaling-stroke' width="200" height="200" viewBox="0 0 50 50"> <circle cx="25" cy="25" r="20" fill="none" stroke="#fff" stroke-width="2"/> <path d="M25 15 L 25 35" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round"/> <path d="M15 25 L 35 25" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round"/> </svg> </div> <span> 50 x 50 view box<br> 200 x 200 dimensions<br> no vector effect </span> </div> <div class="Item"> <div class="Item-graphic"> <svg id='non-scaling-stroke' width="200" height="200" viewBox="0 0 50 50"> <circle cx="25" cy="25" r="20" fill="none" stroke="#fff" stroke-width="2" vector-effect="non-scaling-stroke"/> <path d="M25 15 L 25 35" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke"/> <path d="M15 25 L 35 25" fill="none" stroke="#fff" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke"/> </div> </svg> <span> 50 x 50 view box<br> 200 x 200 dimensions<br> vector effect </span> </div> CSS *, *::before, *::after { box-sizing: border-box; } body { display: flex; align-items: center; justify-content: center; width: 100vw; height: 100vh; background-color: #2196F3; font-family: Helvetica, sans-serif; font-weight: 300; line-height: 1.5; } svg { display: block; margin: 0 auto; } .Item { flex: 0 0 200px; padding: 0 1rem; color: rgba(#fff, 0.6); font-size: 11px; text-align: center; } .Item-graphic { display: flex; align-items: center; height: 220px; } JS n=1;inc=1; cvb = function(){ vb = '' + n vb += ' ' + n vb += ' ' + 2*(25-n) vb += ' ' + 2*(25-n) $('#non-scaling-stroke').attr('viewBox', vb) $('#scaling-stroke').attr('viewBox', vb) n += inc; if (n<=1 || n>=24) inc *= -1; setTimeout(cvb, 100); }; cvb()
It is a bug in Chrome. The bug report is here https://bugs.chromium.org/p/chromium/issues/detail?id=849080. It was fixed in Chrome version 68.0.3440.25.
Aligning Icomoon icons and getting correct shape
Kind of struggling to get my icons aligned and in the proper shape. I'm trying to achieve that in the footer I can print 4 social icons in line each in a cikel, and somewhere else on the page have 4 social icons appearing in line (flexbox), and square. However if I have the icons aligned as square buttons, than the cirkel become ovals. What is the way to go and to have the icons styled independently and make sure they are responsive? I just put all the code, a bit much, sorry for that. .social-container { display: flex; /* flex-direction: row; */ flex-wrap: wrap; justify-content: space-between; min-height: 0%; flex: 0; } .social-container a { } /* #mixin svg { position: relative; display: inline-flex; min-width: 0; */ a.svg, a.arrow { position: relative; display: inline-flex; min-width: 0; } a.arrow { text-decoration-line: none; } a.svg { /* display: inline-flex; */ text-decoration-line: none; position: relative; } a.svg:after { content: ""; position: absolute; top: 0; right: 0; bottom: 0; left:0; } .social-container a svg { height: 3vh; margin-bottom: 10px; } .cirkel { background: #3b5998; padding: 0.2em; display: inline-block; line-height: 0; -webkit-border-radius: 99%; -moz-border-radius: 99%; border-radius: 99%; } .cirkel:hover { background-color: brown; } .square { display: inline-flex; /* height: 25px; line-height: 30px; */ -webkit-border-radius: 5px; -moz-border-radius: 5px; border-radius: 5px; margin-right: 5px; height: 30px; width: 80px; padding-top: 0.2em; padding-bottom: 0.2em; padding-right: 0.2em; } .square.fb-background { background: #3b5998; } .square.tw-background { background-color: #4da7de; } .square.pi-background { background-color: #b51205; } .square.gp-background { background-color: #dd4b39; } .flex-item { height: 5%; } .name{ font-size: 0.5em; margin-left: 1em; } /* styling individual icons */ .icon { display: inline-block; width: 1em; height: 1em; stroke-width: 0; stroke: currentColor; fill: currentColor; } /* obsolete styls */ .access-label { text-decoration: none; } /* ========================================== Single-colored icons can be modified like so: .icon-name { font-size: 32px; color: red; } ========================================== */ .icon-home3 { color:blue; } .icon-arrow-left2 { width: 30px; min-height: 0vh; } .icon-arrow-left2:hover { background-color:#013e75; color: white; } .icon-facebook:before { content:'\e041'; } /* .icon-facebook { color: #fff; font-size: 32px; } */ .icon-facebook { color: white; font-size: 20px; /* width: 20%; height: 2%; */ padding: 3px; } .icon-facebook:hover { background-color: #2a4784; } .icon-google-plus:before { content:'\e042'; } .icon-google-plus { /* width: 20%; * / height: 2%; */ color: white; font-size: 20px; } .icon-google-plus:hover { background-color: #c93725; } .icon-linkedin2:before { content:'\e049'; } .icon-linkedin2 { background-color: #3371b7; color: white; /* width: 20%; */ height: 2%; } .icon-linkedin2:hover { background-color: #1f5da3; } .icon-pinterest2:before { content:'\e043'; } .icon-pinterest2 { color: white; /* width: 20%; */ padding: 3px; height: 2%; font-size: 20px; } .icon-pinterest:hover { } .icon-price-tag { width: 20px; height: 25px; display: inline; padding-top: 5px; } /* same styling icons used in text heading tag <H4> */ .icon-price-tags, .icon-camera, .icon-bubbles { color: white; } .icon-sailing-boat-water { color: blueviolet; } .icon-price-tags, .icon-camera, .icon-bubbles { height: 25px; display: inline; padding-top: 4px; width: 30px; min-height: 0vh; } .icon-rss:before { content:'\e00b'; } .icon-rss { /* width: 20%; */ height: 2%; padding: 3px; background-color: #f26109; color: white; } .icon-rss:hover { background-color: #de4d00; } .icon-search { color: #ccc; } .icon-search:hover { color: blueviolet; } .icon-twitter:before { content:'\e040'; } .icon-twitter { color: white; /* width: 20%; */ height: 2%; padding: 3px; font-size: 20px; } .icon-twitter:hover { background-color: #3993ca; } <!doctype html> <html> <head> <title>IcoMoon - SVG Icons</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="demo-files/demo.css"> <link rel="stylesheet" href="demo-files/probeersel.css"> <!-- link rel="stylesheet" href="SVG/cssfolder-SVG_SPRITE/iconizr-svg-sprite.css" --> <!-- link rel="stylesheet" href="style.css" --> </head> <body> <svg aria-hidden="true" style="position: absolute; width: 0; height: 0; overflow: hidden;" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> <defs> <symbol id="icon-sailing-boat-water" viewbox="0 0 32 32"> <title>sailing-boat-water</title> <path d="M21.671 23h0.329c2.209 0 3.999-1.795 3.999-4h-10v-15h-1v15h-10c0 0.876 0.282 1.686 0.759 2.345 3.661-1.772 7.586-1.975 11.486 0.219 1.515 0.852 2.993 1.312 4.426 1.436v0 0zM26 18h-9v-9l9 9zM8 9.5c-3 5-3 8.5-3 8.5h9c0 0-1-1.5-1-6s1-8 1-8c0 0-3 0.5-6 5.5v0zM3 25c0.432-0.319 0.901-0.634 1.405-0.934 4.032-2.406 8.441-2.965 12.82-0.502 4.021 2.262 7.786 1.761 11.12-0.452 0.623-0.414 1.177-0.857 1.655-1.299v1.322c-0.341 0.277-0.709 0.549-1.102 0.81-3.622 2.405-7.778 2.957-12.164 0.491-4.022-2.262-8.065-1.75-11.817 0.489-0.713 0.425-1.353 0.881-1.911 1.336-0.002 0.002-0.004 0.003-0.006 0.005v-1.266zM5.979 26.232c3.592-1.665 7.43-1.813 11.245 0.333 3.481 1.958 6.771 1.846 9.755 0.344v1.109c-3.143 1.433-6.616 1.46-10.245-0.581-3.645-2.050-7.307-1.822-10.755-0.094v-1.11z"></path> </symbol> <symbol id="icon-home3" viewbox="0 0 32 32"> <title>home3</title> <path d="M32 19l-6-6v-9h-4v5l-6-6-16 16v1h4v10h10v-6h4v6h10v-10h4z"></path> </symbol> <symbol id="icon-camera" viewbox="0 0 32 32"> <title>camera</title> <path d="M9.5 19c0 3.59 2.91 6.5 6.5 6.5s6.5-2.91 6.5-6.5-2.91-6.5-6.5-6.5-6.5 2.91-6.5 6.5zM30 8h-7c-0.5-2-1-4-3-4h-8c-2 0-2.5 2-3 4h-7c-1.1 0-2 0.9-2 2v18c0 1.1 0.9 2 2 2h28c1.1 0 2-0.9 2-2v-18c0-1.1-0.9-2-2-2zM16 27.875c-4.902 0-8.875-3.973-8.875-8.875s3.973-8.875 8.875-8.875c4.902 0 8.875 3.973 8.875 8.875s-3.973 8.875-8.875 8.875zM30 14h-4v-2h4v2z"></path> </symbol> <symbol id="icon-file-text" viewbox="0 0 32 32"> <title>file-text</title> <path d="M27 0h-24c-1.65 0-3 1.35-3 3v26c0 1.65 1.35 3 3 3h24c1.65 0 3-1.35 3-3v-26c0-1.65-1.35-3-3-3zM26 28h-22v-24h22v24zM8 14h14v2h-14zM8 18h14v2h-14zM8 22h14v2h-14zM8 10h14v2h-14z"></path> </symbol> <symbol id="icon-profile" viewbox="0 0 32 32"> <title>profile</title> <path d="M27 0h-24c-1.65 0-3 1.35-3 3v26c0 1.65 1.35 3 3 3h24c1.65 0 3-1.35 3-3v-26c0-1.65-1.35-3-3-3zM26 28h-22v-24h22v24zM8 18h14v2h-14zM8 22h14v2h-14zM10 9c0-1.657 1.343-3 3-3s3 1.343 3 3c0 1.657-1.343 3-3 3s-3-1.343-3-3zM15 12h-4c-1.65 0-3 0.9-3 2v2h10v-2c0-1.1-1.35-2-3-2z"></path> </symbol> <symbol id="icon-price-tag" viewbox="0 0 32 32"> <title>price-tag</title> <path d="M30.5 0h-12c-0.825 0-1.977 0.477-2.561 1.061l-14.879 14.879c-0.583 0.583-0.583 1.538 0 2.121l12.879 12.879c0.583 0.583 1.538 0.583 2.121 0l14.879-14.879c0.583-0.583 1.061-1.736 1.061-2.561v-12c0-0.825-0.675-1.5-1.5-1.5zM23 12c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3z"></path> </symbol> <symbol id="icon-price-tags" viewbox="0 0 40 32"> <title>price-tags</title> <path d="M38.5 0h-12c-0.825 0-1.977 0.477-2.561 1.061l-14.879 14.879c-0.583 0.583-0.583 1.538 0 2.121l12.879 12.879c0.583 0.583 1.538 0.583 2.121 0l14.879-14.879c0.583-0.583 1.061-1.736 1.061-2.561v-12c0-0.825-0.675-1.5-1.5-1.5zM31 12c-1.657 0-3-1.343-3-3s1.343-3 3-3 3 1.343 3 3-1.343 3-3 3z"></path> <path d="M4 17l17-17h-2.5c-0.825 0-1.977 0.477-2.561 1.061l-14.879 14.879c-0.583 0.583-0.583 1.538 0 2.121l12.879 12.879c0.583 0.583 1.538 0.583 2.121 0l0.939-0.939-13-13z"></path> </symbol> <symbol id="icon-bubbles" viewbox="0 0 36 32"> <title>bubbles</title> <path d="M34 28.161c0 1.422 0.813 2.653 2 3.256v0.498c-0.332 0.045-0.671 0.070-1.016 0.070-2.125 0-4.042-0.892-5.398-2.321-0.819 0.218-1.688 0.336-2.587 0.336-4.971 0-9-3.582-9-8s4.029-8 9-8c4.971 0 9 3.582 9 8 0 1.73-0.618 3.331-1.667 4.64-0.213 0.463-0.333 0.979-0.333 1.522zM16 0c8.702 0 15.781 5.644 15.995 12.672-1.537-0.685-3.237-1.047-4.995-1.047-2.986 0-5.807 1.045-7.942 2.943-2.214 1.968-3.433 4.607-3.433 7.432 0 1.396 0.298 2.747 0.867 3.993-0.163 0.004-0.327 0.007-0.492 0.007-0.849 0-1.682-0.054-2.495-0.158-3.437 3.437-7.539 4.053-11.505 4.144v-0.841c2.142-1.049 4-2.961 4-5.145 0-0.305-0.024-0.604-0.068-0.897-3.619-2.383-5.932-6.024-5.932-10.103 0-7.18 7.163-13 16-13z"></path> </symbol> <symbol id="icon-spinner3" viewbox="0 0 32 32"> <title>spinner3</title> <path d="M16 9.472c-1.030 0-1.865-0.835-1.865-1.865v-5.596c0-1.030 0.835-1.865 1.865-1.865s1.865 0.835 1.865 1.865v5.596c0 1.030-0.835 1.865-1.865 1.865z"></path> <path d="M16 31.155c-0.644 0-1.166-0.522-1.166-1.166v-5.596c0-0.644 0.522-1.166 1.166-1.166s1.166 0.522 1.166 1.166v5.596c0 0.644-0.522 1.166-1.166 1.166z"></path> <path d="M11.805 10.48c-0.604 0-1.192-0.314-1.516-0.875l-2.798-4.846c-0.483-0.836-0.196-1.906 0.64-2.389s1.906-0.196 2.389 0.64l2.798 4.846c0.483 0.836 0.196 1.906-0.64 2.389-0.275 0.159-0.576 0.235-0.873 0.235z"></path> <path d="M22.995 29.164c-0.363 0-0.715-0.188-0.91-0.525l-2.798-4.846c-0.29-0.502-0.118-1.143 0.384-1.433s1.143-0.118 1.433 0.384l2.798 4.846c0.29 0.502 0.118 1.143-0.384 1.433-0.165 0.095-0.346 0.141-0.524 0.141z"></path> <path d="M8.729 13.436c-0.277 0-0.557-0.070-0.814-0.219l-4.846-2.798c-0.781-0.451-1.048-1.449-0.597-2.229s1.449-1.048 2.229-0.597l4.846 2.798c0.781 0.451 1.048 1.449 0.597 2.229-0.302 0.524-0.851 0.816-1.415 0.816z"></path> <path d="M28.114 23.927c-0.158 0-0.319-0.040-0.465-0.125l-4.846-2.798c-0.446-0.258-0.599-0.828-0.341-1.274s0.828-0.599 1.274-0.341l4.846 2.798c0.446 0.258 0.599 0.828 0.341 1.274-0.173 0.299-0.486 0.466-0.809 0.466z"></path> <path d="M7.607 17.515h-5.596c-0.837 0-1.516-0.678-1.516-1.515s0.678-1.515 1.516-1.515h5.596c0.837 0 1.516 0.678 1.516 1.515s-0.678 1.515-1.516 1.515z"></path> <path d="M29.989 16.933c-0 0 0 0 0 0h-5.596c-0.515-0-0.933-0.418-0.933-0.933s0.418-0.933 0.933-0.933c0 0 0 0 0 0h5.596c0.515 0 0.933 0.418 0.933 0.933s-0.418 0.933-0.933 0.933z"></path> <path d="M3.886 24.394c-0.483 0-0.954-0.251-1.213-0.7-0.386-0.669-0.157-1.525 0.512-1.911l4.846-2.798c0.669-0.387 1.525-0.157 1.911 0.512s0.157 1.525-0.512 1.911l-4.846 2.798c-0.22 0.127-0.461 0.188-0.698 0.188z"></path> <path d="M23.27 12.736c-0.322 0-0.636-0.167-0.809-0.466-0.258-0.446-0.105-1.016 0.341-1.274l4.846-2.798c0.446-0.257 1.016-0.105 1.274 0.341s0.105 1.016-0.341 1.274l-4.846 2.798c-0.147 0.085-0.307 0.125-0.465 0.125z"></path> <path d="M9.004 29.397c-0.218 0-0.438-0.055-0.64-0.172-0.613-0.354-0.823-1.138-0.469-1.752l2.798-4.846c0.354-0.613 1.138-0.823 1.752-0.469s0.823 1.138 0.469 1.752l-2.798 4.846c-0.237 0.411-0.668 0.641-1.112 0.641z"></path> <path d="M20.196 9.664c-0.158 0-0.319-0.040-0.465-0.125-0.446-0.258-0.599-0.828-0.341-1.274l2.798-4.846c0.258-0.446 0.828-0.599 1.274-0.341s0.599 0.828 0.341 1.274l-2.798 4.846c-0.173 0.299-0.486 0.466-0.809 0.466z"></path> </symbol> <symbol id="icon-search" viewbox="0 0 32 32"> <title>search</title> <path d="M31.008 27.231l-7.58-6.447c-0.784-0.705-1.622-1.029-2.299-0.998 1.789-2.096 2.87-4.815 2.87-7.787 0-6.627-5.373-12-12-12s-12 5.373-12 12 5.373 12 12 12c2.972 0 5.691-1.081 7.787-2.87-0.031 0.677 0.293 1.515 0.998 2.299l6.447 7.58c1.104 1.226 2.907 1.33 4.007 0.23s0.997-2.903-0.23-4.007zM12 20c-4.418 0-8-3.582-8-8s3.582-8 8-8 8 3.582 8 8-3.582 8-8 8z"></path> </symbol> <symbol id="icon-arrow-up2" viewbox="0 0 32 32"> <title>arrow-up2</title> <path d="M27.414 12.586l-10-10c-0.781-0.781-2.047-0.781-2.828 0l-10 10c-0.781 0.781-0.781 2.047 0 2.828s2.047 0.781 2.828 0l6.586-6.586v19.172c0 1.105 0.895 2 2 2s2-0.895 2-2v-19.172l6.586 6.586c0.39 0.39 0.902 0.586 1.414 0.586s1.024-0.195 1.414-0.586c0.781-0.781 0.781-2.047 0-2.828z"></path> </symbol> <symbol id="icon-arrow-right2" viewbox="0 0 32 32"> <title>arrow-right2</title> <path d="M19.414 27.414l10-10c0.781-0.781 0.781-2.047 0-2.828l-10-10c-0.781-0.781-2.047-0.781-2.828 0s-0.781 2.047 0 2.828l6.586 6.586h-19.172c-1.105 0-2 0.895-2 2s0.895 2 2 2h19.172l-6.586 6.586c-0.39 0.39-0.586 0.902-0.586 1.414s0.195 1.024 0.586 1.414c0.781 0.781 2.047 0.781 2.828 0z"></path> </symbol> <symbol id="icon-arrow-left2" viewbox="0 0 32 32"> <title>arrow-left2</title> <path d="M12.586 27.414l-10-10c-0.781-0.781-0.781-2.047 0-2.828l10-10c0.781-0.781 2.047-0.781 2.828 0s0.781 2.047 0 2.828l-6.586 6.586h19.172c1.105 0 2 0.895 2 2s-0.895 2-2 2h-19.172l6.586 6.586c0.39 0.39 0.586 0.902 0.586 1.414s-0.195 1.024-0.586 1.414c-0.781 0.781-2.047 0.781-2.828 0z"></path> </symbol> <symbol id="icon-google-plus" viewbox="0 0 32 32"> <title>google-plus</title> <path d="M10.181 14.294v3.494h5.775c-0.231 1.5-1.744 4.394-5.775 4.394-3.475 0-6.313-2.881-6.313-6.431s2.838-6.431 6.313-6.431c1.981 0 3.3 0.844 4.056 1.569l2.762-2.662c-1.775-1.656-4.075-2.662-6.819-2.662-5.631 0.006-10.181 4.556-10.181 10.188s4.55 10.181 10.181 10.181c5.875 0 9.775-4.131 9.775-9.95 0-0.669-0.075-1.181-0.163-1.688h-9.613z"></path> <path d="M32 14h-3v-3h-3v3h-3v3h3v3h3v-3h3z"></path> </symbol> <symbol id="icon-facebook" viewbox="0 0 32 32"> <title>facebook</title> <path d="M19 6h5v-6h-5c-3.86 0-7 3.14-7 7v3h-4v6h4v16h6v-16h5l1-6h-6v-3c0-0.542 0.458-1 1-1z"></path> </symbol> <symbol id="icon-twitter" viewbox="0 0 32 32"> <title>twitter</title> <path d="M32 7.075c-1.175 0.525-2.444 0.875-3.769 1.031 1.356-0.813 2.394-2.1 2.887-3.631-1.269 0.75-2.675 1.3-4.169 1.594-1.2-1.275-2.906-2.069-4.794-2.069-3.625 0-6.563 2.938-6.563 6.563 0 0.512 0.056 1.012 0.169 1.494-5.456-0.275-10.294-2.888-13.531-6.862-0.563 0.969-0.887 2.1-0.887 3.3 0 2.275 1.156 4.287 2.919 5.463-1.075-0.031-2.087-0.331-2.975-0.819 0 0.025 0 0.056 0 0.081 0 3.181 2.263 5.838 5.269 6.437-0.55 0.15-1.131 0.231-1.731 0.231-0.425 0-0.831-0.044-1.237-0.119 0.838 2.606 3.263 4.506 6.131 4.563-2.25 1.762-5.075 2.813-8.156 2.813-0.531 0-1.050-0.031-1.569-0.094 2.913 1.869 6.362 2.95 10.069 2.95 12.075 0 18.681-10.006 18.681-18.681 0-0.287-0.006-0.569-0.019-0.85 1.281-0.919 2.394-2.075 3.275-3.394z"></path> </symbol> <symbol id="icon-rss" viewbox="0 0 32 32"> <title>rss</title> <path d="M4.259 23.467c-2.35 0-4.259 1.917-4.259 4.252 0 2.349 1.909 4.244 4.259 4.244 2.358 0 4.265-1.895 4.265-4.244-0-2.336-1.907-4.252-4.265-4.252zM0.005 10.873v6.133c3.993 0 7.749 1.562 10.577 4.391 2.825 2.822 4.384 6.595 4.384 10.603h6.16c-0-11.651-9.478-21.127-21.121-21.127zM0.012 0v6.136c14.243 0 25.836 11.604 25.836 25.864h6.152c0-17.64-14.352-32-31.988-32z"></path> </symbol> <symbol id="icon-linkedin2" viewbox="0 0 32 32"> <title>linkedin2</title> <path d="M12 12h5.535v2.837h0.079c0.77-1.381 2.655-2.837 5.464-2.837 5.842 0 6.922 3.637 6.922 8.367v9.633h-5.769v-8.54c0-2.037-0.042-4.657-3.001-4.657-3.005 0-3.463 2.218-3.463 4.509v8.688h-5.767v-18z"></path> <path d="M2 12h6v18h-6v-18z"></path> <path d="M8 7c0 1.657-1.343 3-3 3s-3-1.343-3-3c0-1.657 1.343-3 3-3s3 1.343 3 3z"></path> </symbol> <symbol id="icon-pinterest2" viewbox="0 0 32 32"> <title>pinterest2</title> <path d="M16 0c-8.825 0-16 7.175-16 16s7.175 16 16 16 16-7.175 16-16-7.175-16-16-16zM16 29.863c-1.431 0-2.806-0.219-4.106-0.619 0.563-0.919 1.412-2.431 1.725-3.631 0.169-0.65 0.863-3.294 0.863-3.294 0.45 0.863 1.775 1.594 3.175 1.594 4.181 0 7.194-3.844 7.194-8.625 0-4.581-3.738-8.006-8.544-8.006-5.981 0-9.156 4.019-9.156 8.387 0 2.031 1.081 4.563 2.813 5.369 0.262 0.125 0.4 0.069 0.463-0.188 0.044-0.194 0.281-1.131 0.387-1.575 0.031-0.137 0.019-0.262-0.094-0.4-0.575-0.694-1.031-1.975-1.031-3.162 0-3.056 2.313-6.019 6.256-6.019 3.406 0 5.788 2.319 5.788 5.637 0 3.75-1.894 6.35-4.356 6.35-1.363 0-2.381-1.125-2.050-2.506 0.394-1.65 1.15-3.425 1.15-4.613 0-1.063-0.569-1.95-1.756-1.95-1.394 0-2.506 1.438-2.506 3.369 0 1.225 0.412 2.056 0.412 2.056s-1.375 5.806-1.625 6.887c-0.281 1.2-0.169 2.881-0.050 3.975-5.156-2.012-8.813-7.025-8.813-12.9 0-7.656 6.206-13.863 13.862-13.863s13.863 6.206 13.863 13.863c0 7.656-6.206 13.863-13.863 13.863z"></path> </symbol> </defs> </svg> <header class="bgc1 clearfix"> <div class="mhl"> <p> SVG Icons - Generated by IcoMoon </p> </div> </header> <svg class="icon icon-sailing-boat-water" aria-hidden="true" focusable="false"> <use xlink:href="#icon-sailing-boat-water"></use> </svg> <br /> <br /> <span class="cirkel"><svg preserveaspectratio="none" class="icon icon-facebook"><use xlink:href="#icon-facebook"></use></svg></span> <br /> <br /> <span class="cirkel"><svg preserveaspectratio="none" class="icon icon-facebook"><use xlink:href="#icon-facebook"></use></svg></span> <br /> <br /> <span class="social-container" style="width: 400px;"> <span class="square fb-background"><svg preserveaspectratio="none" class="icon icon-facebook"><use xlink:href="#icon-facebook"></use></svg></span> <span class="square tw-background"><svg preserveaspectratio="none" class="icon icon-twitter"><use xlink:href="#icon-twitter"></use></svg></span> <span class="square pi-background"><svg preserveaspectratio="none" class="icon icon-pinterest2"><use xlink:href="#icon-pinterest2"></use></svg></span> <span class="square gp-background"><svg preserveaspectratio="none" class="icon icon-google-plus"><use xlink:href="#icon-google-plus"></use></svg></span> </span> <p> </body> </html>
align svg elements using "symbol" and "use" method
I have created a svg icon pack with the help of svg symbol so that I can use it later. I am using it with the help of svg use. Now my question is, is there any way to align the svg vertically and horizontally center. I have tried using position:absolute and flexbox but no success. I also played with width, height and viewbox property of svg but no success .carousel-control { width: 30px; height: 30px; background: #fff; left: 0; top: 0; border-radius: 50%; border: 1px solid #faad40; text-align: center; display: inline-block; position: relative; } svg.icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <symbol id="arrow-up" viewBox="0 0 30 30"> <path fill-rule="evenodd" fill="rgb(0, 0, 0)" d="M0.096,3.259 C-0.045,3.395 -0.045,3.622 0.096,3.763 C0.232,3.900 0.458,3.900 0.593,3.763 L3.141,1.205 L3.141,9.647 C3.141,9.844 3.297,10.000 3.493,10.000 C3.689,10.000 3.849,9.844 3.849,9.647 L3.849,1.205 L6.392,3.763 C6.533,3.900 6.759,3.900 6.895,3.763 C7.035,3.622 7.035,3.395 6.895,3.259 L3.744,0.095 C3.608,-0.046 3.382,-0.046 3.247,0.095 L0.096,3.259 Z"/> </symbol> <symbol id="arrow-down" viewBox="0 0 30 30"> <path fill-rule="evenodd" fill="rgb(0, 0, 0)" d="M6.873,6.720 C7.013,6.584 7.013,6.358 6.873,6.217 C6.738,6.081 6.513,6.081 6.378,6.217 L3.842,8.767 L3.842,0.352 C3.842,0.156 3.687,-0.000 3.492,-0.000 C3.296,-0.000 3.136,0.156 3.136,0.352 L3.136,8.767 L0.605,6.217 C0.465,6.081 0.240,6.081 0.105,6.217 C-0.035,6.358 -0.035,6.584 0.105,6.720 L3.241,9.874 C3.377,10.014 3.602,10.014 3.736,9.874 L6.873,6.720 Z"/> </symbol> </svg> <a class="left carousel-control"><svg class="icon" width="30px" height="30px;"><use xlink:href="#arrow-up" /></svg></a> <a class="left carousel-control"><svg class="icon" width="30px" height="30px;"><use xlink:href="#arrow-up" /></svg></a>
You need to decrease the viewBox to cover only the icon shape. Actually it's set to go up to 30 and the width/height of the SVG is 30px (same as the container) so it is centred but the path inside the SVG is not. You may then specify any dimension to your icon, not necessarily the same as the viewbox: .carousel-control { width: 30px; height: 30px; background: #fff; border-radius: 50%; border: 1px solid #faad40; display: inline-flex; vertical-align:top; align-items:center; justify-content:center; position: relative; } <svg xmlns="http://www.w3.org/2000/svg" style="display: none;"> <symbol id="arrow-up" viewBox="0 0 8 10"> <path fill-rule="evenodd" fill="rgb(0, 0, 0)" d="M0.096,3.259 C-0.045,3.395 -0.045,3.622 0.096,3.763 C0.232,3.900 0.458,3.900 0.593,3.763 L3.141,1.205 L3.141,9.647 C3.141,9.844 3.297,10.000 3.493,10.000 C3.689,10.000 3.849,9.844 3.849,9.647 L3.849,1.205 L6.392,3.763 C6.533,3.900 6.759,3.900 6.895,3.763 C7.035,3.622 7.035,3.395 6.895,3.259 L3.744,0.095 C3.608,-0.046 3.382,-0.046 3.247,0.095 L0.096,3.259 Z"/> </symbol> <symbol id="arrow-down" viewBox="0 0 8 10"> <path fill-rule="evenodd" fill="rgb(0, 0, 0)" d="M6.873,6.720 C7.013,6.584 7.013,6.358 6.873,6.217 C6.738,6.081 6.513,6.081 6.378,6.217 L3.842,8.767 L3.842,0.352 C3.842,0.156 3.687,-0.000 3.492,-0.000 C3.296,-0.000 3.136,0.156 3.136,0.352 L3.136,8.767 L0.605,6.217 C0.465,6.081 0.240,6.081 0.105,6.217 C-0.035,6.358 -0.035,6.584 0.105,6.720 L3.241,9.874 C3.377,10.014 3.602,10.014 3.736,9.874 L6.873,6.720 Z"/> </symbol> </svg> <a class="left carousel-control"><svg class="icon" width="6"><use xlink:href="#arrow-up" /></svg></a> <a class="left carousel-control"><svg class="icon" width="12" ><use xlink:href="#arrow-down" /></svg></a>
Create full width nav using svg
I'm trying to create this nav using an SVG. I was provided with an SVG however it didn't work out so someone on SO helped me make another. However now I am unsure how to create the nav using <svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" width="576" height="152" viewbox="0 0 576 152"> <path transform="translate(10,-185)" d="M 0 189.5 L 39.741071 261.25 L 0 333.125 L 516.63393 332 L 556.375 260 L 516.63393 188 L 0 189.5 Z" stroke="black" stroke-linecap="butt" stroke-linejoin="miter" stroke-width="10" fill="transparent" /> </svg> My current nav looks like <nav> <ul> <li class="completed">Exam <i class="fa fa-check-circle"></i></li> <li>Personal <i class="fa fa-times-circle"></i></li> <li>Employment</li> <li>Appointment</li> <li>Record Check</li> <li>Submit</li> </ul> </nav> With just a white background. So it looks close to what the image looks like just minus the SVG shape.
First, your SVG needed a little changes to correctly scale itself (with preserveAspectRatio="none") and some more adjusts to your specific layout: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xl="http://www.w3.org/1999/xlink" version="1.1" width="576" height="152" viewbox="0 0 576 152" preserveAspectRatio="none"> <path transform="translate(10, -185)" d="M 0 189.5 L 39.741071 261.25 L 0 333.125 L 516.63393 332 L 556.375 260 L 516.63393 188 L 0 189.5 Z" stroke="black" stroke-opacity="0.1" stroke-linecap="butt" stroke-linejoin="miter" stroke-width="2" fill="white" /> </svg> And here's the CSS using it: nav ul { margin: 0; padding: 0; list-style: none; display: flex; flex-flow: row wrap; } nav li { background: url('path/to/your.svg') no-repeat; background-size: 100% 100%; flex: 1 1 auto; margin: 0 -5px; } nav a { display: block; font: bold 1rem Sans-serif; color: rgba(0, 0, 0, .25); padding: 1em 2em; text-align: center; text-decoration: none; } nav li.completed a { color: rgba(0, 0, 0, .5); } If you like, here's a working sample.