Make Money Online!
Hi, I'm Ben and I own Create a Great Website! I'm currently earning well over $1,500 plus per month online in my spare time, and I want to show you how you can do the same.
Fill out the form below and I'll send you my free guide to create a great website and how you can earn money online just like I do! You won't be disappointed.
Make Money Online!
CSS Tutorials :
CSS List Tutorial
The CSS list allows you to control the styling of list elements in an HTML document. The list-style-property is used to present different types of lists through a variety of marker styles for bulleted lists and numbered lists.
The list-style-image property is used to provide a custom marker for each list item. The list-style-position property is used to control the positioning of list item markers.
The CSS List properties give you complete control over the way you present and style list items.
CSS List properties allow you to:
Set different list item markers for numbered or ordered lists
Set
different list item markers for bulleted or unordered lists
Set an image as the list item marker
List (list-style-property)
You use the list-style-property to change the presentation of bulleted and numbered lists. In HTML, there are two types of lists:
- unordered or bulleted lists - the list items are marked with bullets
- ordered or numbered lists - the list items are marked with numbers or letters
With CSS, lists can be styled further, and images can be used as the list item marker. For example, you can change an ordered list to a list using Roman numerals for markers, or you can change a bulleted list to one using squares instead of circles for markers.
For bulleted lists, the default value is disc style markers.
For numbered lists, the default
Styling Bulleted or Unordered Lists
The type of list item marker that appears before the list item is specified with the list-style-type property. It can be applied to either the <ul> or <li> elements
Example
ul.b {list-style-type:square;}
li#disc {list-style-type:disc;}
li#none {list-style-type:none;}
Some of the property values for unordered lists are shown in the table below:
Values for Bulleted or Unordered Lists
| Value | Description |
| none | No marker |
| disc | Default. The marker is a filled circle |
| circle | The marker is a circle |
| square | The marker is a square |
Styling Numbered or Ordered Lists
Ordered lists can be styled using a variety of different lettering and numbering conventions.
Example
ol.d {list-style-type:lower-alpha;}
Some of the property values for ordered lists are shown in the table below:
Values for Numbered or Ordered Lists
| Value | Description |
| armenian | The marker is traditional Armenian numbering |
| decimal | The marker is a number |
| decimal-leading-zero | The marker is a number padded by initial zeros |
| georgian | The marker is traditional Georgian numbering (an, ban, gan, etc.) |
| lower-alpha | The marker is lower-alpha (a, b, c, d, e, etc.) |
| lower-greek | The marker is lower-greek (alpha, beta, gamma, etc.) |
| lower-latin | The marker is lower-latin (a, b, c, d, e, etc.) |
| lower-roman | The marker is lower-roman (i, ii, iii, iv, v, etc.) |
| upper-alpha | The marker is upper-alpha (A, B, C, D, E, etc.) |
| upper-latin | The marker is upper-latin (A, B, C, D, E, etc.) |
| upper-roman | The marker is upper-roman (I, II, III, IV, V, etc.) |
An Image as The List Item Marker
Like the list-style-type property, you can use the list-style-image property to change the marker used for list items. The list-style-image property is most suited for custom bulleted lists like the red spheres used on this website.
The list-style-image property is very straightforward; it accepts a file path to the image location, which is denoted by the url notation.
Example
{
list-style-image:url{'sqpurple.gif');
}
li {
list-style-image:url{'arrowred.png');
}
The example above does not display equally well in all browsers. IE and Opera will display the image-marker a little bit higher than Firefox, Chrome, and Safari.
If you want the image-marker to be placed equally in all browsers, a crossbrowser solution is explained below.
The list-style-position Property
You can use the list-item-position property to control the placement of list item markers and whether the list item marker appears on the inside of the list item element or outside of it. Where the list marker is placed is only obvious when the <li> element has a border.
The values for the list-style-position are:
- inside
- outside
The default value is outside.
Example
background: lightblue;
}
ul#inside {
list-style-position: inside;
}
ul#outside {
list-style-position: outside;
}
Crossbrowser Solution
The following example displays the image-marker equally in all browsers:
Example
{
list-style-type:none;
padding:0px;
marginL0px;
}
li
{
background-image:url(sqpurple.gif);
background-repeat:no-repeat;
background-position:0px 5px;
padding-left:14px
}
Example explained:
- For ul:
- Set the list-style to none to remove the list marker
- Set both padding and margin to 0px (for cross-browser compatibility)
- For li
- Set the URL of the image, and show it only once (no-repeat)
- Position the image where you want it (left 0px and down 5px)
- Position the text in the list with padding-left
List - Shorthand Property
The list-style shorthand property allows multiple properties to be combined into one property. It enables you to specify from one to three values, with each value corresponding to the list style properties discussed above, list-style-type, list-style-image, and list-style-position.
The shorthand property used for lists, is the list-style property:
Example
{
list-style:square url("sqpurple.gif");
}
When using the shorthand property, the order of the values are:
- list-style-type
- list-style-position (for a description, see the CSS properties table below)
- list-style-image
It does not matter if one of the values above are missing, as long as the rest are in the specified order.
Find this page useful?
It will appear on your page as: CSS List
Share this Webpage
This site proudly build with Site Build It!





