Home > Web Front-end > CSS Tutorial > How to Create a Responsive Separator for Horizontal Lists That Disappears on Line Breaks?

How to Create a Responsive Separator for Horizontal Lists That Disappears on Line Breaks?

Patricia Arquette
Release: 2024-12-17 14:55:10
Original
501 people have browsed it

How to Create a Responsive Separator for Horizontal Lists That Disappears on Line Breaks?

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;
}
Copy after login
<div>
    word<b> </b>.repeat(42)
</div>
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template