LoginSignup
8
5

More than 5 years have passed since last update.

HTML,CSSで乃木坂46のロゴを描く

Last updated at Posted at 2017-11-17

HTML,CSSで乃木坂46のロゴを描く

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>乃木坂ロゴ</title>
  <style>
  .nogilogo {
    background: linear-gradient(to bottom right, #fff 50%, #812990 50.3%) no-repeat bottom right/100% 100%;
    width: 200px;
    height: 200px;
    position: relative;
  }
  .nogilogo::after {
    content: "46";
    font: 60px/1em -webkit-pictograph;
    color: #fff;
    right: 4px;
    bottom: 0;
    position: absolute;
  }
  </style>
</head>
<body>
  <div class="nogilogo"></div>
</body>
</html>

結果

image.png
こんな感じになる。

メモ

コメントで教えて頂いたスタイルに修正した。

background: linear-gradient(to bottom right, #fff 50%, #812990 50.3%) no-repeat bottom right/100% 100%;

ボーダーをトリッキーな使い方をしていたため、余計な空白が空いたりしたけど、linear-gradientだととてもスマート。

font: 60px/1em -webkit-pictograph;

fontのおかげで簡略化された。 :clap:

旧スタイル

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>乃木坂ロゴ</title>
  <style>
  .nogilogo {
    display: inline-block;
    position: relative;
    border-style: solid;
    border-width: 0 0 200px 200px;
    border-color: transparent transparent #812990 transparent;
  }
  .nogilogo::after {
    content: "46";
    width: max-content;
    position: absolute;
    bottom: -210px;
    right: 2px;
    color: white;
    font-size: 64px;
    font-family: -webkit-pictograph;
  }
  </style>
</head>
<body>
  <span class="nogilogo"></span>
</body>
</html>
  border-style: solid;
  border-width: 0 0 200px 200px;
  border-color: transparent transparent #812990 transparent;

cssで三角形を作るときには定番のボーダー

  display: inline-block;

inline-blockでないと謎の空間が上に出てくる。

.nogilogo::after {
  content: "46";
  width: max-content;
  position: absolute;
  bottom: -210px;
  right: 2px;
  color: white;
  font-size: 64px;
  font-family: -webkit-pictograph;
}

もっと簡略化できそうな気がする。

8
5
4

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
8
5