6
4

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.

要素の基準点を中心にして中央配置

Last updated at Posted at 2018-10-30
transform: translate(-50%, -50%);

を使うと楽。

html,
body {
  height: 100%;
}
.area {
    position: relative;
    width:100%;
    height:100%;
    background-color: #006d6f;
}
.area .circle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #fff;
}
.area .triangle {
    position: absolute;
    top: 50%;
    left: 55%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background:
      linear-gradient(to bottom left, transparent 50%, #006d6f 53%) no-repeat top/100% 50%,
      linear-gradient(to top left, transparent 50%, #006d6f 53%) no-repeat bottom/100% 50%;
}

See the Pen JmqvWp by horikeso (@horikeso) on CodePen.

6
4
0

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
6
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?