Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Ordered list

Posted on 2014-02-18
12
Medium Priority
?
195 Views
Last Modified: 2014-02-20
My client wants an ordered list. Easy enough... except

All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers... in a bright blue. Fortunately, he doesn't want to change typefaces, but this is bad enough.

I have a workaround (in line images), but is this sort of thing at all possible? And if so, how?

Thanks,

ep
0
Comment
Question by:Eric AKA Netminder
  • 4
  • 4
  • 4
12 Comments
 
LVL 61

Assisted Solution

by:Julian Hansen
Julian Hansen earned 600 total points
ID: 39869630
There are many ways to skin this cat.

You could just style the li and then put the content in its own tags and style those. Or you could create a list-style none and add your own numbers - two examples below.
<!doctype html>
<html>
<head>
<title>Test</title>
<script type="text/javascript">
$(function() {
	
});
</script>
<style type="text/css">
ol {
  font-size: 28px;
  color: blue;
}
ol li p {
  font-size: 12px;
  color: #000;
}
ul {
	list-style: none;
	padding: 0;
}
ul li span {
	padding-right: 10px;
	font-size: 28px;
	color: blue;
	text-align: right;
	display: inline-block;
	width: 35px;
}
</style>
</head>
<body>
<ol>
  <li><p>First Item with some text to make this about thirty words long and some more text just to add words and make this the right length. I hate test data.</p></li>
  <li><p>Second Item</p></li>
  <li><p>Third Item</p></li>
  <li><p>Fourth Item</p></li>
  <li><p>...</p></li>
  <li><p>Tenth Item</p></li>
</ol>
<ul>
  <li><span>1.</span>First Item with some text to make this about thirty words long and some more text just to add words and make this the right length. I hate test data.</li>
  <li><span>2.</span>Second Item</li>
  <li><span>3.</span>Third Item</li>
  <li><span>...</span> ...</li>
  <li><span>10.</span>Tenth Item</li>
</ul>

</body>
</html>

Open in new window

0
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 39870346
you could also do something like this, which styles the actual numbers:

<!doctype html>
<html>
<head>
<title></title>

<style>
ol {
    counter-reset:li; /* Initiate a counter */
    margin:0; /* Remove the default left margin */
    padding:0; /* Remove the default left padding */
}
ol > li {
    list-style:none; /* Disable the normal item numbering */
}
ol > li:before {
    content:counter(li); /* Use the counter as content */
    counter-increment:li; /* Increment the counter by 1 */

    -moz-box-sizing:border-box;
    -webkit-box-sizing:border-box;
    box-sizing:border-box;
    width:2em;

    margin-right:8px;
    color:blue;
    font-weight:bold;
    font-size: 28px;
    font-family:"Helvetica Neue", Arial, sans-serif;
    text-align:center;
}

</style>
</head>
<body>
<ol>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
</ol>


</body>
</html>

Open in new window


you could add a dor if you wanted, like this:
content:counter(li) ".";
0
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 1400 total points
ID: 39870401
Here is an alternative version in which the text is indented across multiple lines:

<!doctype html>
<html>
<head>
<title></title>

<style>
ol {
    counter-reset:li; /* Initiate a counter */
    margin:0; /* Remove the default left margin */
    padding:0; /* Remove the default left padding */
}
ol > li {
    list-style:none; /* Disable the normal item numbering */
    margin:0 0 0 2em; /* Give each list item a left margin to make room for the numbers */
    padding:8px;
    position:relative;
}
ol > li:before {

    content:counter(li) "."; /* Use the counter as content */
    counter-increment:li; /* Increment the counter by 1 */
    /* Position and style the number */
    position:absolute;
    top:-2px;
    left:-2em;
    -moz-box-sizing:border-box;
    -webkit-box-sizing:border-box;
    box-sizing:border-box;
    width:2em;
    /* Some space between the number and the content in browsers that support
       generated content but not positioning it (Camino 2 is one example) */
    margin-right:8px;
    padding:8px;
    color:blue;
    font-weight:bold;
    font-size: 28px;
    font-family:"Helvetica Neue", Arial, sans-serif;
    text-align:center;

}

</style>
</head>
<body>
<ol>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
  <li>All of the items are between 20 and 50 words (two to six lines) in good ol' black text, and he would like them with significantly larger numbers</li>
</ol>


</body>
</html>

Open in new window

0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 15

Author Closing Comment

by:Eric AKA Netminder
ID: 39870603
Outstanding. All three solutions work; however, Kyle's was almost copy and paste for my particular situation (I just had to change the font and size).

Couldn't ask for better; thanks!

ep
0
 
LVL 61

Expert Comment

by:Julian Hansen
ID: 39871458
Just a note - the accepted solution may have an issue with older browsers. Personally I don't care about IE - I don't support it - but in case it is an issue just bear it in mind.
0
 
LVL 15

Author Comment

by:Eric AKA Netminder
ID: 39871496
Julian,

I tested it in my client's pages using (among other things) IE8 on a Windows XP machine. Considering the nature of the client's business, I don't think it's much of a concern earlier than that.

Thanks, though.

ep
0
 
LVL 61

Expert Comment

by:Julian Hansen
ID: 39871738
IE8 on a Windows XP machine
Interesting - can't get it to work on IE8 / XP here.
0
 
LVL 15

Author Comment

by:Eric AKA Netminder
ID: 39871961
If you'd like, I can send you the page.
0
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 39871975
it works for me in Ie8

however, supporting ie8 is not something i do anymore. move on.
0
 
LVL 15

Author Comment

by:Eric AKA Netminder
ID: 39871982
*laughing*... were it not for this client, I wouldn't support it either (okay, that and the fact that I'm still not sure whether I want to pick up a new machine in the next month or so, or load a whole new OS on this one and then reinstall all the software).
0
 
LVL 61

Expert Comment

by:Julian Hansen
ID: 39872524
I am a staunch advocate of killing off anything IE - only raised it in case it was an issue.

Reason it was not working here - IE7 Compatibility mode - issue closed.

@Kyle - nice solution
0
 
LVL 25

Expert Comment

by:Kyle Hamilton
ID: 39873080
:)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

577 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question