center svg code example

Example 1: vertically center an svg

.svg-wrapper {
  display: flex;
  align-items: center;
  height: 100%;
}

.svg-wrapper > svg {
  display: block;
  margin: 0 auto;
  text-align: center;
}

Example 2: 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;
}

Tags:

Html Example