<!DOCTYPE html> | |
<style> | |
body { margin: 0; } | |
.parent { | |
position: relative; | |
display: flex; | |
width: 100%; | |
height: 100px; | |
background: red; | |
} | |
.content { | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
bottom: 0; | |
margin: auto; | |
width: 100px; | |
height: 100px; | |
background: green; | |
} | |
svg { | |
width: 50px; | |
height: 50px; | |
} | |
</style> | |
<div class="parent"> | |
<div class="content"> | |
<svg xmlns="http://www.w3.org/2000/svg"></svg> | |
</div> | |
</div> |