CSS Reference

"bottom" - css property (v. css 2)

  • Like 'top' , but specifies how far a box's bottom margin edge is offset above the bottom of the box's containing block.
  • For relatively positioned boxes, the offset is with respect to the bottom edge of the box itself.
  • Initial value: auto
  • The property is not inherited
  • HTML usage: All positioned elements.
  • Browsers that support the bottom - property :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari

Possible box positioning values:

value Comments CSS
length With this you specify a positive(+) or negative(-) value followed with a unit identifier. 1
percentage With this you specify a value with a percentage. It refer to width of containing block for the left and right properties. It refer to height of containing block for the top and bottom properties. Negative values are allowed. 1
auto The outcome of this property value is much dependant on the related containing block type, replaced or none-replaced elements and the browser. For details, please study computing widths and margins for behavior. 1
inherit Will inherit the value from parent specification. This property value is new with CSS 2. 2

Possible unit identifier:

unit identifier Comments CSS
em The relative unit 'em' is relative to the font size of the element itself. 1
ex The relative unit 'ex' is relative to the font size of the element itself. 1
px Pixels, relative to the viewing device 1
in inches -> 1 inch is equal to 2.54 centimeters. 1
cm centimeters. 1
mm millimeters. 1
pt points -> the points used by CSS2 are equal to 1/72th of an inch. 1
pc picas -> 1 pica is equal to 12 points. 1

Property "bottom" example:

<!DOCTYPE HTML >
<html  >
  <head>
    <title>Test</title>
    <script type="text/javascript" >
    </script>
    <style   type="text/css">
      div { position:absolute;
            height: 100px;
            width:  100px; }
      .d0 { background-color: #FFFFDD;
            height: 200px;
            width:  200px; }
      .d1 { background-color: #d6d6d6;
            bottom: 10px;
            left: 20px;}
      .d2 { background-color: #aad5ff;
            top: 20px;
            right: 10px;}
      </style>
    </head>
    <body >
      <div class="d0" >
      This is the outer div text.
      <div class="d2" >
        This div has top: 20px; and right: 10px;
      </div>
      <div class="d1" >
        This div has bottom: 10px; and left: 20px;
      </div>
    </div>
  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.bottom="bottom value"
// To GET values you must first get the computed style object
// To get that object in IE or Opera:
var cStyle=[o].currentStyle;
// To get that object in Firefox, Chrome or Safari (w3c-type):
var cStyle=window.getComputedStyle([o],null)
// To GET the property value:;
var value=cStyle.bottom;
/* The returned value is not cross-browser reliable. The value can vary in accuracy and notation, which depends on the browser, whether the value is preset or not and which option that was used to set the value.*/
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.