Interview Questions

How do I move the list bullet to the left/right?

CSS Interview Questions and Questions


(Continued from previous question...)

108. How do I move the list bullet to the left/right?

CSS1 has no properties for setting margins or padding around the bullet of a list itemand in most cases the position of the bullet is browser-dependent. This is especially true since most browsers disagreed on whether a bullet is found within the margin or padding of a list item.
In CSS2, properties were introduced to provide greater control over the placement of bullets (which CSS2 calls a "marker") but these were not widely supported by mid-2001 browsers. Here is an example of changing a marker's placement:
li:before {display: marker; marker-offset: 22px; content: url(triangle.jpg);}
In this example, a graphic of a triangle is inserted before the content of the li element, set to be a marker (through display: marker;), and given an offset of 22 pixels. Depending on the margin size of the list item, there may not be room for the marker to appear next to the list item's content.

(Continued on next question...)

Other Interview Questions