The traditional way to remove text-decoration from only a child element was to make it an inline-block
. (Example 1 in Fiddle)
However, this method does not work in flexbox.
How can I remove the underline from just the icon in Example 2?
.div1 {
text-decoration: underline;
.icon {
display: inline-block;
text-decoration: none;
}
}
.div2 {
display: flex;
align-items: center;
text-decoration: underline;
.icon {
display: inline-block;
text-decoration: none;
}
}
Fiddle: https://jsfiddle.net/mz4y3jgL/8/