[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

Text alignment conundrum, or, is it possible to control number color in an ordered list?

Greetings,

It's been a while since I've had a plain production job, and this is the first time I am working with a print designer to build a website based on a Quark document.

Anyhow, if you go to http://stevenjs.com/avocado/reciFoto.htm, then proceed to one of the ten recipe links, you can see page and source.

The conundrum is this. Designer wants the numbers left of  indented or seemingly indented text, but a different color. In fact, two different colors. See,  http://stevenjs.com/avocado/avoBeet.htm for an example of the look and alignment desired. However, the Avocado & Beet page was edited on a Mac to get the numbers to align with their corresponding paragraphs, hence they will appear misaligned on a PC, being separated vertically with a spacer.gif, which renders differently across platform browsers.

The way I have it now, the numbers are in their own table, the text in another, though it would make little difference, and in fact it was originally done, as one table.

I would just designate table heights, but this has to be 4x browser compliant as well as Mac versions, and table heights are not supported cross-browser.

I have tried <br>'s but these are blunt instruments, and produce only "more or less" alignment.

If the color attribute of the number of an ordered list could be controlled with cross-browser CSS, even with a hack, that would be ideal, as an ordered list is just the right look, just the wrong number color.

Should I just tell him it is impossible? Or am I missing something entirely. Or is there some new and ingenious solution just waiting to be found?

regards,

stevenjs
____________________________________
"I am but an egg."
--Stranger in a Strange Land
0
stevenjs
Asked:
stevenjs
  • 5
1 Solution
 
whitefaelCommented:
You can use CSS to do this. Just put this in your stylesheet:

li {
      list-style-type: decimal;
      list-style-position: outside;
      margin-left: -15px;
}


Just keep in mind that you might have to play with the negative left margin a little to get it to line up.

Hope this helps!
Brian
0
 
whitefaelCommented:
I missed the color part in your post. I'm looking at it now...
0
 
whitefaelCommented:
Okay, you can do it this way:

CSS:
li {
      list-style-type: decimal;
      color:red;      
      list-style-position: outside;
      margin-left: -15px;
}

code {
      color:black;
}

Then, in your HTML:
<ul>
    <li><code>List Item</code></li>
    <li><code>List Item</code></li>
    <li><code>List Item</code></li>
</ul>


This should work. You can modify the font style anyway you want using CSS.

Hope this helps!
Brian
0
Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

 
whitefaelCommented:
Make that <ol> for an ordered list. This just isn't my day ;)
0
 
stevenjsAuthor Commented:
Thanks, really clever CSS.

I wonder, though, is it possible to get rid of the decimal next to the number?

And, which browsers does it not work in?

stevenjs
______________________
"I am but an egg."
--Stranger in a Strange Land

0
 
whitefaelCommented:
As far as I know, there isn't a way to remove the decimal point next to the number. If someone else knows, I would like to see it, too. As for browser support, I know it works in IE 5, 5.5, and 6; and it works with Firefox 1.0PR. I don't have access to any other browsers at the moment or I would try them too.

Brian
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now