--- title: bottom slug: Web/CSS/bottom tags: - CSS - CSS プロパティ - CSS 位置指定レイアウト - Reference translation_of: Web/CSS/bottom ---
bottom は CSS のプロパティで、位置指定要素の垂直位置の設定に関与します。位置指定されていない要素には効果はありません。
bottom の効果は、要素がどの様に配置されているか (つまり、 {{cssxref("position")}} プロパティの値) によって変わります。
position が absolute または fixed に設定されている場合、 bottom プロパティは要素の下辺と包含ブロックの下辺との間の距離を指定します。position が relative に設定されている場合、 bottom プロパティは要素の下辺が通常位置から上方向へ移動する量を指定します。position が sticky に設定されている場合、 bottom プロパティは sticky 制約の矩形を計算するために使用されます。position が static に設定されている場合、 bottom プロパティは効果がありません。{{cssxref("top")}} と bottom の両方が指定されており、 position が absolute または fixed に設定されており、かつ {{cssxref("height")}} が未指定 (auto または 100% のどちらか) の場合は、 top と bottom の距離が尊重されます。それ以外の場合、 {{cssxref("height")}} が何らかの形で制約されていた場合、または position が relative に設定されていた場合は、 top プロパティが優先されて bottom プロパティは無視されます。
/* <length> 値 */ bottom: 3px; bottom: 2.4em; /* 内包ブロックの高さに対する <percentage> */ bottom: 10%; /* キーワード値 */ bottom: auto; /* グローバル値 */ bottom: inherit; bottom: initial; bottom: unset;
autoheight: auto は内容物の高さに基づいて決まります。また、 top も auto であった場合は、要素は垂直方向には静的要素が配置される場合と同様に配置されます。top も auto であった場合は、垂直方向には移動しません。inheritauto キーワードと同様に扱われます。この例は、 {{cssxref("position")}} が absolute と fixed であった場合の bottom プロパティの動作の違いを示します。
<p>This<br>is<br>some<br>tall,<br>tall,<br>tall,<br>tall,<br>tall<br>content.</p> <div class="fixed"><p>Fixed</p></div> <div class="absolute"><p>Absolute</p></div>
p {
font-size: 30px;
line-height: 2em;
}
div {
width: 48%;
text-align: center;
background: rgba(55,55,55,.2);
border: 1px solid blue;
}
.absolute {
position: absolute;
bottom: 0;
left: 0;
}
.fixed {
position: fixed;
bottom: 0;
right: 0;
}
{{EmbedLiveSample('Example','500','250')}}
| 仕様書 | 状態 | 備考 |
|---|---|---|
| {{SpecName('CSS3 Positioning', '#propdef-bottom', 'bottom')}} | {{Spec2('CSS3 Positioning')}} | sticky の位置の動作を追加 |
| {{SpecName('CSS2.1', 'visuren.html#choose-position', 'bottom')}} | {{Spec2('CSS2.1')}} | 初回定義 |
{{cssinfo}}
{{Compat("css.properties.bottom")}}