.sample-text-link {
color: var(--text-link--color);
display: inline-flex;
font-size: Rem.rem(14);
line-height: Rem.rem(20);
background: transparent;
font-weight: var(--text-link--font-weight);
outline: none;
position: relative;
text-decoration: none;
align-items: center;
border: none;
padding: 0;
.sample-icon {
height: Rem.rem(20);
width: Rem.rem(20);
}
&:hover {
cursor: pointer;
border-width: var(--text-link-hover--border-width);
border-style: var(--text-link-hover--border-style);
border-color: var(--text-link-hover--color);
--text-link--color: var(--text-link-hover--color);
}
}
<a href="" class="sample-text-link"> <span class="sample-icon" title="information"></span> Text Link,Text Link,Text Link,Text Link,Text Link,Text Link,Text Link,Text Link,Text Link,Text Link,Text Link,Text Link,Text Link, Text Link,Text LinkText Link,Text Link,Text Link,Text Link,Text Link,
Text Link,Text Link,Text Link,</a>
I am using following css attached code and images.Please help me to get expected result underline should come to multiple lines. I am using following css attached code and images.Please help me to get expected result underline should come to multiple lines on hover underline should display to multiple lines.
2
Answers
Update
display: inline-flex;
todisplay: inline;
: which ensures that the link behaves like a typical inline element, which is required for text decoration to apply across multiple lines.Add
text-decoration: underline;
: This explicitly sets the underline for the link.Solution 1: Use text-decoration-skip-ink: none (Modern Browsers)
Some browsers skip underlining parts of text to avoid overlapping descenders. Adding this property ensures the underline is applied properly to all lines.
Solution 2: Use border-bottom for Custom Underline
border-bottom gives you more control over how the underline looks and works across multiple lines.
Solution 3: Use box-shadow as an Underline Alternative
If you need a more styled underline, box-shadow can also be used.