Bottom Property

Last updated: 2026-09-13

bottom Bottom Property

The bottom property defines the offset of a positioned element from the bottom edge of its containing block, measured upward. It only applies to non-static positioned elements and is typically used with absolute or fixed positioning to align elements to the bottom or stretch their height.

Category
Initial Valueauto
InheritedNo
Applies To
Animation Type
CSS VersionCSS2
StatusStandard

📝 Syntax

bottom: auto | <length> | <percentage>;

⚙️ Values

ValueTypeDescription
autoKeywordNo offset.
<length> | <percentage>TypeAn offset from the containing block's bottom edge.

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
bottom v1 v12 v1 v1 v1
Supported in all major browsers
Warning: bottom only affects non-static positioned elements; it has no effect on position:static.
Tip: A percentage is computed against the containing block's height. Setting both top and bottom (without a height) stretches the element to fill the vertical space.

❓ FAQ

QWhat happens when both top and bottom are set?
AFor absolute or fixed positioning without a height, the element stretches to fill the space between top and bottom, enabling adaptive vertical stretching; with a height set, top wins and bottom is ignored. With relative positioning, top takes priority. This technique is often used for full-height background layers and flexible regions between a bottom bar and a top-aligned element, giving the box a height that adjusts automatically.
QWhat is the bottom percentage relative to?
AThe percentage is computed against the containing block's height. For absolute elements the containing block is the padding box of the nearest positioned ancestor; for fixed it is the viewport; for relative it is the element's original position. For example, bottom:0 aligns the element's bottom edge with the containing block's bottom, and combining it with left:0; right:0 makes the element hug the bottom and stretch full width.
QHow do I fix a button or toolbar to the bottom?
ATo pin it to the viewport bottom, use position:fixed; bottom:0; left:0; right:0, and it stays put while scrolling; give the body padding-bottom so content is not hidden underneath. To pin it within a container, make the parent position:relative and the child position:absolute; bottom:0; left:0; right:0. Both are common for bottom toolbars and action bars, and the fixed variant is the basis of mobile app bars.
QWhich has higher priority: bottom or top?
AWhen the element has a height, top wins and bottom is ignored, since top is preferred in LTR's vertical direction by default. Without a height, top and bottom together determine the element's height by stretching it to fill the gap, similar to how left and right work horizontally. For precise control, set only one of them so the behavior stays predictable.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏