grayp1
07-18-2005, 01:04 PM
Hi All,
I've just been learning CSS on the fly and now I'm trying to do something that I thought would be quite straightforward..
All I want to do, is display an icon next to a line of certain text in a list..
Example:
o List Item 1
o List Item 2
o List Item 3 [i]
o List Item 4
Each List item is bulletted, but List Item 3 requires an icon next to it (denoted by the [i]).
So far in my CSS sheet, I have the following:
div.contentBox li {
color: #000000;
font-size: 80%;
text-align: left;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
list-style: url(li_list.gif) square;
}
This is the HTML code i'm using for that:
<div class="contentBox">
<ul>
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
<li>List Item 4</li>
</ul>
What I have kludged so far to demonstrate what I want to do, is the following:
<li>List Item 3 <img src="my_image.gif" alt="My Image"></img></li>
This works great, except if I even come to change the "my_image.gif" to something else, I obviously have to go and change all my HTML.
So, big question, how do I create a new class or div or whatever, so I can wrap that "List Item 3" and show an Icon next to it in CSS ?
i.e. <li>List Item 3 <CSS.image> </li>
I hope you understand what i'm trying to do.. :)
cheers,
Grayp
I've just been learning CSS on the fly and now I'm trying to do something that I thought would be quite straightforward..
All I want to do, is display an icon next to a line of certain text in a list..
Example:
o List Item 1
o List Item 2
o List Item 3 [i]
o List Item 4
Each List item is bulletted, but List Item 3 requires an icon next to it (denoted by the [i]).
So far in my CSS sheet, I have the following:
div.contentBox li {
color: #000000;
font-size: 80%;
text-align: left;
padding: 0px 0px 0px 0px;
margin: 0px 0px 0px 0px;
list-style: url(li_list.gif) square;
}
This is the HTML code i'm using for that:
<div class="contentBox">
<ul>
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
<li>List Item 4</li>
</ul>
What I have kludged so far to demonstrate what I want to do, is the following:
<li>List Item 3 <img src="my_image.gif" alt="My Image"></img></li>
This works great, except if I even come to change the "my_image.gif" to something else, I obviously have to go and change all my HTML.
So, big question, how do I create a new class or div or whatever, so I can wrap that "List Item 3" and show an Icon next to it in CSS ?
i.e. <li>List Item 3 <CSS.image> </li>
I hope you understand what i'm trying to do.. :)
cheers,
Grayp
