Answers for "how to align svg inside a div"

4

how to center text in svg

<text x="50%" y="50%" text-anchor="middle" dominant-baseline="middle">Text</text>
Posted by: Guest on April-07-2020
0

html align svg to text

/* html-part: Pay attention to the correct name */
<div class="icon baseline">
    <svg width="48" height="48" viewBox="0 0 48 48">
       <path .../>
  	</svg>
</div>

/* css-part */
.svg-icon {
  display: inline-flex;
  align-self: center;
}

.svg-icon svg {
  height:1em;
  width:1em;
}

.svg-icon.svg-baseline svg {
  top: .125em;
  position: relative;
}
Posted by: Guest on December-07-2020

Code answers related to "how to align svg inside a div"

Browse Popular Code Answers by Language