10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Flexboxでborderの重なりが気になる場合

Posted at

結果だけ先に書くと

.flex-item {
  /* border: 1px solid black; */
  box-shadow : 0 0 0 1px black;
}

border: 1px solid black; だと下みたいに、borderが重なる時に太くなっちゃう。
 2019-09-07 11.20.07.png

box-shadow : 0 0 0 1px black; だと内側に影として枠線をつけるので、重ならない!
 2019-09-07 11.22.29.png

参考

<div id="flex-container">
  <div class="flex-item">flexアイテム1</div>
  <div class="flex-item">flexアイテム2</div>
  <div class="flex-item">flexアイテム3</div>
</div>
#flex-container {
  display: flex;
  width: 600px;
}
.flex-item {
  width: 200px;
  padding: 10px;
  text-align: center;
  /* border: 1px solid black; */
  /* ↓↓↓ */
  box-shadow : 0 0 0 1px black;
  background-color: gray;
}

 2019-09-07 11.22.29.png

10
10
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?