Responsive Separator for Horizontal List
Question:
How can you remove separators at line breaks caused by changes in viewport size?
Example:
| Item 1 | Item 2 | Item 3 | Item 4 | Item 5 |
|---|---|---|---|---|
When the viewport narrows:
Item 1 | Item 2 | Item 3 |
---|---|---|
Item 4 | Item 5 |
Note that the separator remains at the line break.
Possible Solution:
CSS-only:
You can leverage the collapsing of trailing white spaces:
b { background: red; outline: 1px solid blue; } div { resize: both; overflow: hidden; }
<div> word<b> </b>.repeat(42) </div>
The above is the detailed content of How to Create a Responsive Separator for Horizontal Lists That Disappears on Line Breaks?. For more information, please follow other related articles on the PHP Chinese website!