Solved

Auto number list - text alignment

Posted on 2014-01-31
4
823 Views
Last Modified: 2014-02-27
Hello all, I am experiencing some difficulty aligning chapter headings, where I have incorporated auto numbered lists using a proportional font.

An example (I'll use code to ensure the text appears as intended):

1.1     Chapter 1.1 Header
1.2       Chapter 1.2 header
2.1       Chapter 2.1 header
2.2         Chapter 2.2 header

Open in new window

The above example may be slightly exaggerated but the issue is all the chapters should be aligned, however, the font is dictating where the chapter text begins.
 
Q. Is there a way to lock the position of the chapter text using just css?

Caveat... I am generating my document using MadCap Flare. Although it is almost entirely html/css, it does utilize a few custom styles. Unless you understand Flare, please try to ignore that fact and try to help me with a pure css correction (if possible). :-)

Here is a sample HTML excerpt:
<h2 MadCap:autonum="1.1">Chapter 1.1 text</h2>
        <p>This...</p>
<h2 MadCap:autonum="1.2">Chapter 1.2 text</h2>

Open in new window


And the .css excerpt for h2 HTML5 output:
	{
		font-weight: bold;
		color: #d93e0b;
		font-size: 14pt;
		mc-auto-number-format: 'GH:{n}.{n+}        ';
		mc-auto-number-position: inside-head;
		/* text-indent: 55px; */
		margin-left: 0px;
		padding-left: -20px;
	}

Open in new window


You will notice the 8 spaces after "GH:{n}.{n+}". This is the root of the problem because the distance these spaces make up are relative to the font. I need a css solution so that I don't need those spaces to separate the chapter number from the chapter title.

I realize that the special MadCap only classes may put a wrench in your ability to assist.

Thank you
0
Comment
Question by:sconnell
  • 2
  • 2
4 Comments
 
LVL 58

Expert Comment

by:Gary
Comment Utility
Do you have a link to the page so we can see what's going on?
0
 
LVL 4

Author Comment

by:sconnell
Comment Utility
Unfortunately, I am unable to now because it is published on a private server.

Perhaps, for the moment, I can re-frame the question to...

How do you create an auto-numbered list using only .css styles using a proportional font?

In this format:
1.0  Main title

1.1         Subtitle A
1.2         Subtitle B
...and so on. 

Open in new window


Note: There would be about 2 spaces between the main chapter number and title and about 8 spaces between sub-chapter numbers and the name. All the chapter numbers should always align regardless of the font used.

Thanks so much.
0
 
LVL 58

Accepted Solution

by:
Gary earned 500 total points
Comment Utility
Something like this
http://jsfiddle.net/GaryC123/MzR3M/2/

You would just need to tweak the margins

HTML
<ol>
    <li><div>Main Item</div><ol>
        <li><div>item<p>This...</p></div></li>
    <li><div>item<p>This...</p></div></li>
    <li><div>item<p>This...</p></div></li>
    <li><div>item<p>This...</p></div></li>
        <li><div>item<p>This...</p></div></li>
        </ol>
        </li>
<ol>

Open in new window

CSS
ol {
		font-weight: bold;
		color: #d93e0b;
		font-size: 14pt;
		margin-left: 0px;
    counter-reset: item 
}
li {
display:block;
}

li div {
    display:inline-block;
        vertical-align:top;
    margin-left:20px
}
li:before {
     content: counters(item, "."); counter-increment: item;
}

Open in new window

0
 
LVL 4

Author Comment

by:sconnell
Comment Utility
Hello Cathal,

THAT is an awesome resource. Thank you! :-)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

771 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

9 Experts available now in Live!

Get 1:1 Help Now