Help us understand the problem. What is going on with this article?

CSSのTips

背景

CSS書いていると「あれはどうやってやるんだっけ」とかよくある。

目的

やりたいことをすぐ引き出せるように。
「何をしたいか?実現したいか?」という目的志向で書いていこうと思う。

Q. 文字と文字の間隔を詰めたい

A. letter-spacingでマイナス値を指定する

span {
    letter-spacing: -1px;
}

Q. テキストをブロック要素内の上下中央に配置したい

A. line-heightをブロック(インラインブロック)要素のheightに合わせる

div {
    height: 100px;
}
div span {
    line-height: 100px;
}

もちろん、インライン要素をdisplay:inline-blockで等でブロック化して、同一要素にheightline-heightの両方を指定してもいい。

Q. table要素のボーダーをなくしたい(セル同士を密着させたい)

A. table要素に対してborder-collapse: collapseをあてる

table {
    border-collapse: collapse;
}
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away