I need help creating a component with a horizontal list of links. When the link text is too long, I want the entire word to wrap to the next line instead of getting cut off.
Below is an image showing my current progress on the component. The links are breaking in the middle or overflowing outside of the parent element.
https://i.sstatic.net/fwKXs.png
The "Mind and Soul" link breaks midway, while "Must Go Places" extends beyond the parent container.
SCSS/
.sidebar-widget {
position: relative;
z-index: 1;
background-color: #eff4f9;
padding: 60px 25px;
margin-bottom: 40px;
h3 {
font-size: 30px;
margin-bottom: 30px;
font-weight: 400;
color: $primary-color;
@media #{$breakpoint-xs} {
font-size: 24px;
}
}
.sub-category-item {
border: 2px solid black;
border-radius: 5px;
a {
font-weight: 700;
color: $secondary-color;
padding: 2px;
}
margin-right: 20px;
}
}
HTML
<div className="sidebar-widget">
<h3>Sub Categories</h3>
<span className="sub-category-item">
<a href="#"> Random words </a>
</span
<div>