LoginSignup
2
1

More than 5 years have passed since last update.

将棋盤の上と右の数字をCSSだけで表現

Last updated at Posted at 2018-04-04

完成形

See the Pen CSS sample for Japanese chess board axis position by Akira Ikeda (@akicho8) on CodePen.

要点

  1. 最初の tr に属する td の :before に content: "9" などとして数字を埋める
  2. td からの相対座標で上にずらして上側が完成
  3. 同様に最後の td に対して content: "一" などとして漢数字を埋める
  4. このとき :before を使うと "1" を埋めている右上地点の content を上書きしてしまうことになる
  5. なので右側の漢数字を表すときは :after の content を使う
  6. あとは同様に右にずらして完成

右上が干渉するので上と右でそれぞれ before と after を使い分けるというのがしっくりきませんが、とりあえず表示するだけならCSSだけでも可能ということがわかりました。

2
1
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
2
1