The CSS reference

"list-style-position" - css property (v. css 1)

  • To specify if the list-item markers should appear inside or outside the content flow.
  • Initial value: outside
  • The property is inherited
  • HTML usage: elements with 'display: list-item'
  • Browsers that support the list-style-position - property :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari

Possible list-style-position values:

Values Comments CSS
inside Means that the marker box is placed as the first inline box in the principal block box, before the element's content and before any ':before' pseudo-elements. 1
outside Means that the marker box is outside the principal block box. 1
inherit Will inherit the value from parent specification. 2

Property "list-style-position" example:

<!DOCTYPE HTML >
<html>
  <head>
    <style   type="text/css">
      div {width: 300px;}
      .o1 {
        list-style-type: upper-roman;
      }
      .u1 {
        list-style-image: url(images/Marker.png);
        list-style-position: inside;
      }
    </style>
  </head>
  <body >
    <div>
      Possible list-style properties
      <ol class="o1">
        <li>list-style-images</li>
        <li>list-style-position</li>
        <li>list-style-type</li>
        <li>list-style
          <ul class="u1">
            <li>Shorthand notation for setting
              all the three previous properties.
              (list-style-position: inside)</li>
          </ul>
        </li>
      </ol>
    </div>
  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.listStylePosition="list-style-position 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.listStylePosition;
© 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.