Solved

Ordered list

Posted on 2014-02-18
12
180 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:ericpete
  • 4
  • 4
  • 4
12 Comments
 
LVL 51

Assisted Solution

by:Julian Hansen
Julian Hansen earned 150 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 350 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
 
LVL 15

Author Closing Comment

by:ericpete
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 51

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:ericpete
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 51

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:ericpete
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:ericpete
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 51

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now