Stylized paragraphs in CSS format complete with numbered paragraphs and informative sidenotes

I'm currently working on formatting text for the web, including paragraph numbers and sidenotes. As a test, I am using Huckleberry Finn. I sought help on this matter previously (link unavailable). I have made some progress in my efforts.

However, I have encountered a new issue. While I have managed to implement the sidenotes, it requires me to deviate from the main paragraph styling (view link below). This not only seems like poor programming practice but also disrupts the indentation scheme for "p + p". On the other hand, if I do not deviate, the sidenotes receive their own paragraph numbers, resulting in complete chaos (link unavailable).

Does anyone have any suggestions on how to address this? Any help would be greatly appreciated.

EDIT #1: Following bbg's suggestion of utilizing the p.text concept, I attempted to resolve the indentation issues without success. I experimented with 'p.text:before' and 'p.text + p.text' among other variations, but none seem to work. I am feeling quite frustrated.

EDIT #2: In an attempt to make it easier for others to assist me, I have adjusted the widths for better visual presentation on the jsFiddle screens. (1) Sidenotes causing indentation failure: [http://jsfiddle.net/Keh65/5/](https://jsfiddle.net/Keh65/5/). (2) Sidenotes without deviation leading to numbering/everything failure: [http://jsfiddle.net/Keh65/6/](https://jsfiddle.net/Keh65/6/).

Answer №1

@Sarah42; it seems like your question is related to this specific topic. If I have misunderstood, please let me know. I am suggesting the use of p ~ p instead of p + p and replacing p with span in the context of .sidenote.

Answer №2

Introduce an additional class name (such as class="text") for the main body paragraphs to distinguish them from the note paragraphs.

<p class="text">

Utilize this new class name to specify the increment:

p.text {
   counter-increment: paragraph;  
}

http://jsfiddle.net/Keh65/3/

Keep in mind that 'paragraph' is simply a placeholder name for the counter, and it does not have to be directly related to the html <p> element.

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

What is the method for activating a song by clicking a button?

Is it possible to create a button that matches the theme of my website for controlling the song being played with the audio controls? Here is the current code I am using: <audio controls autoplay loop> <source src="Main Theme.mp3" ...

Converting HTML to PDF using AngularJS

Can anyone help me with converting HTML to PDF in Angular? I have tried using the angular-save-html-to-pdf package from npm, but encountered errors. Are there any other solutions or custom directives available for this task? ...

When users visit my contact HTML page, they are redirected to the contact PHP page, but unfortunately, the email is

I am currently facing an issue with my contact form. After filling out the form and hitting the "send" button, it redirects to the contact.php page but fails to send an email or work as intended. Can someone please assist me and identify what's causin ...

The HTML div is not aligned in the center even when using flexbox

After creating a list within a centered flex div, it seems that the list is not aligning properly. I used flex on the list-div2 and the translate rule in the parent's middle-text div, but it still doesn't look centered as expected. Can anyone p ...

I'm struggling to understand the reasoning behind the 'undefined' error occurring in the Google Maps distance service

Currently facing a puzzling issue with an 'undefined' exception. Developing a tool to track distance traveled between two locations, leveraging Google Maps distance matrix. Upon selecting a vehicle, entering an origin and destination, and clickin ...

Floating causes elements to overlap

I recently created a control panel in Dutch where hovering over CV or "geen afspraak" reveals relevant content. However, I encountered an issue - when hovering over CV, "geen afspraak" overlaps the other text, making it partially unreadable. Can anyone off ...

Using a variable as a selector with jQuery's .remove method

My script involves a dynamic variable packet var packet = "" Each time the user clicks a button, the letter 'a' is added to the variable packet = packet + "a" This process also generates three div elements with unique ids based on the variab ...

What causes my variable to show None instead of the current stock price?

I attempted to extract the stock price data from using BeautifulSoup. However, my program is not displaying the stock price and instead showing "None". How can I correctly retrieve the stock price information? My provided code snippet: from bs4 import Bea ...

What is the process for dividing a form into two separate columns?

I am working on a form that sends input to a PHP script. I want to reorganize the form so that the second section (Person 2) appears in a column to the right of the first section (Person 1), instead of below it. <link rel="stylesheet" href="test.css" ...

Can a placeholder pseudo-element possess pseudo-classes?

I am looking to create an animation for the appearance and disappearance of the placeholder pseudo-element in an input[type=text]. My initial approach was to apply styles, including transitions, to pseudo-classes like :active in order to achieve this effec ...

Eliminating vertical spacing between words with CSS

I am trying to nest a span within a button <span style="font-size: 11px; font-weight: 700; white-space: normal; margin-left: -5px;">UPGRADE PLAN</span> When I use white-space: normal, it breaks the word UPGRADE PLAN vertically. However, I am ...

Unique form validation process: utilizing JSON

Attempting to validate JSON input using Angular's FormControl. The typical approach, such as validating an email address, would involve: <form name="form"> <textarea ng-model="data.email" type="email" name="email"></textarea> &l ...

Obtaining a background image within a keyframe

I have been experimenting with keyframe animations and am looking to incorporate multiple images into the animation. Specifically, I want to switch out the image every 10% increment to depict someone running. Despite my efforts to use a background-img in ...

Extracting information from a password text form in asp.net

Hey there, I'm having issues retrieving data from a password textbox. Here is my ASP code: <asp:TextBox ID="txtConfirmPassword" TextMode="Password" runat="server"></asp:TextBox> And here is my C# code on the server side: NameValueCollec ...

submitting data in php from a database table

On my HTML page, I have fields where I input information and then post all the values in PHP. Here is the HTML code: <form action='preViewTallyHdr.php' method='POST' target='_blank'> <p>Supplier Name & ...

Utilizing JavaScript to present JSON data in HTML tables across various sections of a website

Utilizing JScript to retrieve data from a JSON API URL, I have incorporated the data in the JSON file displayed below - containing information on 8 horse races with details like Horse number, Horse name, and their odds. My goal is to create a Jscript code ...

How can I include line breaks using HTML `<br>` tags in a textarea field that is filled with data from a MySQL

Within a modal, I am showcasing a log inside a read-only <textarea> field that contains data fetched from my MySQL database. Below this, there is a writable <textarea> field where users can input updates to the log, which are then added to the ...

When the user clicks on the body, I want the element to slide up, which will then slide down when the button is clicked

As a novice in Jquery, I am currently implementing a simple slide toggle on a button. Initially, the div is set to display none, and when the button is clicked, the slide toggle function is triggered. This works well. However, I also want the div to slide ...

Adjust the color of both the image and text when hovering over either one

I need help creating a hover effect for an image and text pair. My goal is to have the image change when hovered over, along with changing the color of the text next to it. Below is the code I am currently working with: <ul id="recherche"> < ...

PHP Newsletter Creator

Recently, I created a unique php newsletter script in CakePHP that allows users to utilize an in-place editor to generate HTML content for newsletters. While the functionality works well, I have encountered some challenges with a new newsletter design that ...