Click to See Complete Forum and Search --> : Horizontal Bullet Points
F.Danials
09-19-2008, 06:14 AM
Hi,
Using CSS, how do I display bullet points automatically, so they display like the following?:
* Bullet Point 1 * Bullet Point 2 * Bullet Point 3 * Bullet Point 4
<ul>
<li>Bullet Point 1</li>
<li>Bullet Point 2</li>
<li>Bullet Point 3</li>
<li>Bullet Point 4</li>
</ul>
WebJoel
09-19-2008, 08:32 AM
A horizontally UL list is "display:inline;" which by default removes the "list-style-type:value;" (it is "none" by default for "display:inline;") whereby "value" would be disc, circle, square, etc
To get these back, it must be implicitly stated.
Or you could use list-style-image:url(); use a background-image on the "<li>" itself. Some padding might be required, someting like "padding-left:20px;" to get the 'image' to show up
Or, you could float left the <li> with a width set.
F.Danials
09-20-2008, 07:04 AM
To get these back, it must be implicitly stated.
How would you get the bullets back, without using a background-image (list-style-image)?
WebJoel
09-21-2008, 08:30 AM
How would you get the bullets back, without using a background-image (list-style-image)? Bullets are "list-style-type; A "horizontally display" UL list, is "display:inline;" and the default for this IS "list-style-type:none;". This is to eliminate confusion in a society that reads left-to-right, lest user thinks that the " * " is a "LI" itself. But you can 'force' it back, if you need to, by explicitly stating the list-style-type:value;
But to create the visual of this without "list-style-type;value;", use a "background-image" on the LIs. This is actually okay and good, because background-image is presentational and therefore, can be entirely handled by the CSS.
A 20px by 20px "<img>" of the asterisk " * " positioned would suffice. You could use a 'site logo' for the "<img>" too. I have done this, like, for a site about ferrets; I used my 'user avatar' image as "bullets" for LIs.
Something like:li {background:url(asteriskImage.jpg) 0;....}whereby "asterisk.jpg" is the 20px x 20px " * " IMAGE, and " 0 " is position-left:0; (the default unstated position-top; is always "center").
Keep in mind now, that this 20-px wide "image" will be covered-over by whatever 'text' or 'content' appears IN the LI, so you want to "padding-left:30px;" in the LI, to give a 10px "gap" between the " * " and the text... so:
li {background:url(asteriskImage.jpg) 0; padding-left: 20px; }.... would be your code.
When using an IMG for background-image:url() on LIs, you can make the width/height be whatever size you want. I just chose 20px x 20px for the sake of the asterisk image. A typical 'line-height' (height & width of scrollbar, etc) is 20px.
Still with me here? If you have problems, post back & I can whip something up and show code. :)
KDLA's suggestion to float:left; width set width is also good
'lists' are a LOT of fun to do! :D So many ways to do stuff, so many variations!
F.Danials
09-22-2008, 08:40 AM
Cheers for that reply! ;)
The following code works correct in FF, but not in IE.
How do I get the code to work in both FF and IE and therefore be cross browser compatible?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
ul
{
float: right;
}
li
{
float:left;
}
</style>
</head>
<body>
<ul>
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Contact</li>
</ul>
</body>
</html>
If you float a list the bullets will not be displayed in IE. Add background images.