Using HTML5 to create a structured outline with numbered headings at multiple levels

Currently, I am in the process of creating an HTML5 manual that will require numbering for various elements.

  • The main headings should be numbered like "Section 4: Some Stuff"
  • Subheadings will also need numbers such as "4.01: the first point you need to know about some stuff"

To add a further challenge, the manual will include tables and images that will also need to be numbered. For example,

"Fig 4.03 A cat. Most of the images on the internet are of cats."

In addition, there are numerous process lists within the manual that would benefit from numbering under the subheadings. For instance,

4.05 A simple process

4.05.01 Pull a leaf from the tree
4.05.02 Eat it
4.05.03 Now you are a caterpillar
4.05.04 Turn into a beautiful butterfly

I have been exploring different methods to achieve the desired numbering for headings, subheadings, figures, and lists but haven't found a satisfactory solution yet.

Potential solution 1: Utilize CSS counters

However, these may not transfer well to editing programs like Microsoft Word and might not function properly with screen-readers.

Potential solution 2: Implement ordered lists

But if all headings are part of an ordered list with the same 'heading' class, they may simply appear as plain lists without proper CSS styling.

If anyone has already tackled this issue or has a clever solution, I would greatly appreciate your input!

Extra credit goes to anyone who can suggest an efficient way to automatically update my figure cross-references!

Answer №1

Utilize written content.

<h3>Point 4.01: an important factor to understand about certain information</h3>

The numbering serves a practical purpose (you may need to refer back to these numbers), making a CSS fix inadequate.

While using ol is a potential solution in some scenarios, it comes with several limitations:

  • Having to use an ol for the entire document can be cumbersome.
  • Some user-agents may opt not to display any numbers at all.
  • Certain user-agents will not allow users to search for or copy the numbered content.
  • You may not achieve the specific numbering style you desire (for instance, nested ol elements might not include a delimiter like . and restart from 1 instead).

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A commonly used method to adjust the width of a table column to accommodate the size of the child element

I have a specific table width of 776 pixels with three columns. The third column has a fixed width of 216 pixels, but the widths of the other two are unknown. I want the second column to adjust its width based on its content, and whatever space is left aft ...

Adding ng-messages to a new input element that is generated dynamically in an AngularJS application using Material Design can be

I'm having an issue with my code. Everything is working fine except for the ng-messages part - they are not displaying as expected. I believe that ng-messages should be attached to the 'name' element, but it's not working in this case. ...

Where can I locate htmlWebpackPlugin.options.title in a Vue CLI 3 project or how can I configure it?

After creating my webpage using vue cli 3, I decided to add a title. Upon examining the public/index.html file, I discovered the code snippet <title><%= htmlWebpackPlugin.options.title %></title>. Can you guide me on how to change and cu ...

What is the best way to access CSS variables declared in the root element?

For my React project, I have defined color variables. I want to create my own color palette for the DevExtreme pie chart UI component. :root { --my-pastel: var(--rose) var(--beige) var(--bright-orange) var(--brighter-orange) var(--bright-rose) var(--bright ...

When using Ruby on Rails, the image_tag method generates two <img> tags within my HTML code

I recently started learning Ruby on Rails and encountered an issue with resizing images using CSS. After replacing an image field with the Ruby image_tag, I noticed extra blank space below the image. Upon inspecting the element, I found two tags for the s ...

Retrieve image file from computer's hard drive

I have the following HTML Tags: <input id="bigPicture" name="bigPicture" type="file" value=""> <img src="test.png" id="test1"> User select file and I want to preview this file inside ...

Optimizing React+ReactRouter web app loading times by efficiently splitting and loading CSS using WebPack

I am encountering a delay in the initial loading of my web app, even after implementing various improvements like using only critical CSS during server side rendering. Unfortunately, post-SSR, React still generates unnecessary CSS rules that are not utiliz ...

Allowing CSS to break long words but not spaces for better readability

Imagine you have the following paragraph: thisisaverylongwordthatneverbreaks Applying word-wrap:break-word; results in: thisisaverylongwordthat neverbreaks This works well, but what if I try: this is avery long word that has spaces The output becom ...

Building a dynamic search feature using Ajax and PHP to transfer search results to a PHP variable or display as plain text

I designed a form that allows users to input orders with various details into the database. One of the fields in this form is labeled Client, where users have the option to either create a new client or select an existing one. To facilitate the selection ...

The button activation functionality in jQuery seems to be malfunctioning

Here I am updating the user information and handling the update function via an AJAX call. My aim is to disable the modify button when no updates are done, and enable it when we click on the text boxes for update. I have used Keyup and focus but none of ...

Prevent drag and drop functionality in QtWebkit

As I work on creating an HTML GUI for my application using Qt's WebKit, everything is going smoothly with one minor issue. I am trying to prevent users from dragging and dropping images from the GUI itself. While I have successfully disabled text sele ...

Ways to align content on navbar (Bootstrap 5)

I am currently working on a minimal navbar design using Bootstrap 5. In this setup, there are two main elements - the 'navbar-brand' for the logo/brand and the navigation links. My goal is to have the brand/logo aligned all the way to the left, ...

Tips on adjusting section height as window size changes?

Working on a website that is structured into sections. Initially, all links are aligned perfectly upon load. However, resizing the window causes misalignment issues. Check out my progress at: karenrubkiewicz.com/karenportfolio1 Appreciate any help! CSS: ...

"Exploring the concept of odd and even numbers within the ng-repeat

Can anyone help me with detecting odd or even numbers in an ng-repeat? I have created a fiddle that displays some dots randomly showing and hiding. Now, I want to change the background color so that odd numbers are green and even numbers are red. function ...

What is the method for modifying the text color of P tags within a div element?

I'm having trouble changing the text color of the P tags in the card-header section for some reason dashboard.html <div class="container"> <div class="card"> <div class="card-header"> <p& ...

The numbering in the list does not align vertically with the corresponding content

I am attempting to create an ordered list with collapsible sections inside the li elements. The goal is to display basic information about a specific context, and when clicking on a link, additional details are shown. While the code is functional, I am fac ...

Execute a command via a hyperlink

I have a script that displays information in a div using a button. I am trying to modify it so that it works from a link instead, but I haven't had any success yet. Any ideas on how to make this work? <script> function showCustomer(str) { va ...

Conceal table headers on mobile devices for better responsiveness styling

I have implemented jQuery Datatables to display a table and made it mobile responsive. However, I am facing an issue where I want to completely hide the table headers when viewing the table on a mobile device, and show them again on a normal screen. Speci ...

Avoid displaying images that have not completely loaded

My website has a feature that displays user data, including various types of images such as Personal and Learning. To showcase these images, I have implemented a Modal with an img tag. One issue I have encountered is that there is only one Modal and one ...

Is there a way to reveal the full contents of a cell when hovering the mouse, even if it has overflow hidden?

I am facing an issue with tables that contain long strings as values. Is there a way to display the entire content of a table cell if the overflowing content is hidden? I thought about expanding the cell while overlapping adjacent cells without displacing ...