Answers for "svg text-anchor"

0

svg text align middle

<svg width="200" height="100">
  <rect x="0" y="0" width="200" height="100" stroke="red" stroke-width="3px" fill="white"/>
  <text x="50%" y="50%" dominant-baseline="middle" text-anchor="middle">TEXT</text>    
</svg>
Posted by: Guest on July-22-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

Browse Popular Code Answers by Language