JSFiddle - React, Tailwind, and code Playground

by murata_s

HTML

<figure>
  <figcaption>単純な罫線:</figcaption>
  <span class="a">
    <img src="https://cdn-ak.f.st-hatena.com/images/fotolife/m/murata_s/20180120/20180120173018.jpg" alt="">
  </span>
</figure>

<figure>
  <figcaption>左から余白、太め、黒:</figcaption>

  <span class="b">
    <img src="https://cdn-ak.f.st-hatena.com/images/fotolife/m/murata_s/20180120/20180120173018.jpg" alt="">
  </span>

  <span class="c">
    <img src="https://cdn-ak.f.st-hatena.com/images/fotolife/m/murata_s/20180120/20180120173018.jpg" alt="">
  </span>

  <span class="d">
    <img src="https://cdn-ak.f.st-hatena.com/images/fotolife/m/murata_s/20180120/20180120173018.jpg" alt="">
  </span>
</figure>

<figure>
  <figcaption>左から単純な罫線、Pretty Border:</figcaption>

  <span class="a">
    <img src="https://cdn-ak.f.st-hatena.com/images/fotolife/m/murata_s/20180120/20180120173018.jpg" alt="">
  </span>

  <span class="e">
    <img src="https://cdn-ak.f.st-hatena.com/images/fotolife/m/murata_s/20180120/20180120173018.jpg" alt="">
  </span>
</figure>

SCSS

span {
  display: inline-block;
  margin: .5em;
  &:first-of-type {
    margin-left: 0;
  }
}

img {
  max-width: 200px;
  vertical-align: top;
}

.a, .b, .c, .d {
  img {
    border: 1px solid #ccc;
  }
}

.b {
  img {
    padding: 1px;
  }
}

.c {
  img {
    border-width: 5px;
  }
}

.d {
  img {
    border-color: #000;
  }
}

.e {
  position: relative;
  &::after {
    content: '';
    display: block;

    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    border: 1px solid rgba(0, 0, 0, .1);
    box-sizing: border-box;
  }
}