<div id="app">
<main>
<div class="icon-grid">
<h1><icon></icon>Title</h1>
<h3><icon></icon>Title</h3>
<h6><icon></icon>Title</h6>
<hr>
<div class="icon-dynamic">
<h1><icon></icon>Resize Me</h1>
</div>
</hr>
</main>
</div>
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;600;700&display=swap');
* {
box-sizing: border-box;
}
body {
background: #FAFAFA;
font-family: 'Nunito', sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
h1, h3, h6 {
display: inline-flex;
align-items: center;
margin-bottom: 0;
color: #666;
.icon {
margin-right: 0.1em;
}
}
h1 {
font-size: 80px;
}
h3 {
font-size: 40px;
}
h6 {
font-size: 20px;
}
main {
padding: 50px;
}
.icon-grid {
margin-bottom: 100px;
display: flex;
flex-direction: column;
gap: 20px;
hr {
width: 100%;
margin-top: 50px;
}
}
.icon {
container: icon/size;
width: 1em;
height: 1em;
flex-shrink: 0;
svg {
stroke: #ccc;
fill: none;
width: 100%;
height: 100%;
stroke-width: 0.8;
@container icon (max-width: 70px) {
stroke-width: 1.5;
}
@container icon (max-width: 35px) {
stroke-width: 3;
}
}
}
.icon-dynamic {
container: icon-dynamic/inline-size;
overflow: hidden;
resize: horizontal;
h1 {
font-size: 10cqw;
line-height: 1em;
}
}
View Compiled
Vue.component('icon', {
template: `
<span class="icon">
<svg xmlns="http://www.w3.org/2000/svg"
width="44" height="44" viewBox="0 0 24 24" fill="none"
stroke-linecap="round" stroke-linejoin="round">
<path stroke="none" d="M0 0h24v24H0z" fill="none"/>
<polyline points="12 3 20 7.5 20 16.5 12 21 4 16.5 4 7.5 12 3"/>
<line x1="12" y1="12" x2="20" y2="7.5"/>
<line x1="12" y1="12" x2="12" y2="21"/>
<line x1="12" y1="12" x2="4" y2="7.5"/>
</svg>
</span>`
});
let app = new Vue({
el: '#app',
})
This Pen doesn't use any external CSS resources.