Ask Your Question
2

How can I eliminate the line that separates flex items in CSS?

asked 2022-01-15 11:00:00 +0000

woof gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-08-05 18:00:00 +0000

ladyg gravatar image

There are a few ways to eliminate the line that separates flex items in CSS:

  1. Using negative margins: You can apply negative margins to the flex items, which will cause them to overlap, effectively removing the line between them.
.flex-container {
  display: flex;
}

.flex-item {
  margin-right: -1px;
}
  1. Using box-shadow: You can apply a box-shadow to the flex container, which will create a shadow effect that hides the line between the items.
.flex-container {
  display: flex;
  box-shadow: 0 0 0 1px white;
}
  1. Using border-collapse: You can apply the border-collapse property to the flex container and set it to collapse, which will remove the border between the items.
.flex-container {
  display: flex;
  border-collapse: collapse;
}

.flex-item {
  border: 1px solid black;
}
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-01-15 11:00:00 +0000

Seen: 19 times

Last updated: Aug 05 '22