Click here to bookmark this site! Home | Contact | About | Site Map  
 

Quick Menu

Intorducing CSS
CSS - Quick Tutorial
Linking A StyleSheet
CSS Reference
Back Grounds.
Lists
Cursors
Borders
Positioning
Scroll Bars
Layers
Float
Margins
Padding
Fonts
Text
Pseudo Elements

 

DEFINING LISTS IN CSS
There are three basic selectors for lists on CSS and they are:

list-style-type
Defines the look of the bullets, numbers & letters used in your list.

list-style-image
Let's you use a custom graphic for bullets.

list-style-position
Often the text in a list is longer than one line.
list-style-position: outside;
This lets the second line of text align with the first line.
That is: the bullet is to the left of both lines.
list-style-position: inside;
This lets the second line of text align with the bullet.

LIST EXAMPLES BELOW

Google

Web
Eazy HTML

Site Stats

There are 5 users online
click to see where

149,434 total unique visitors
486,642 total pageviews
60 visitors in the last 24 hours
58 total visitors today
204 pageviews today
This page has been visited 1,087 times

get this script
Most users online at once:
63 on 01/18/2010

Valid CSS!

Valid XHTML 1.0!

  • This is one black line
  • This is another line that is much longer than the first. This list has a
    list-style-position of outside. See how the text lines up with the text above in the first line and does not line up with the bullet marking the text.

  • This is one black line
  • This is another line that is much longer than the first. This list has a
    list-style-position of inside. See how the text lines up with the bullet and not the text above in the first line.

  • This is one black line
  • This is another line that is much longer than the first. This list is using the
    list-style-image to use skulls rather than using bullets.

<ul>
<li class="list1">
<span class="blacktext">This is one black line</span></li>
<li class="list1">This is another line that is much longer than the first. This list has a list-style-position of outside. See how the text lines up with the text above in the first line and does not line up with the bullet marking the text.</li>
</ul>

<ul>
<li class="list2">
<span class="blacktext">This is one black line</span></li>
<li class="list2">This is another line that is much longer than the first. This list has a list-style-position of inside. See how the text lines up with the bullet and not the text above in the first line. </li>
</ul>

<ul>
<li class="list3">
<span class="blacktext">This is one black line</span></li>
<li class="list3">This is another line that is much longer than the first. This list is using the<br /> list-style-image to use skulls rather than using bullets.</li>
</ul>

And inside your CSS style sheet this is what you would have:

li.list1 {list-style: circle outside; color:green;}
li.list2 {list-style: square inside; color:blue}
li.list3 {list-style-image:url(../images/skull.gif); color:#FF0000;}
.blacktext {color:black}

OR if your not confident with having your list styles all on one line you can separate them like below:

li.list1{
	list-style-type: square;
	list-style-position: outside;
	color: green;
	}

This way you can individually inspect each style on your list separately.


Copyright © 2004 - EazyHTML.com