Issue with CSS 2.1 failing to validate the first-letter styling

Upon validating my CSS using the W3 validator, an error message was displayed:

The pseudo-element ::first-letter is not allowed in this context css21 [first-letter]

This is the snippet of CSS triggering the error:

#numbersWrapper p span::first-letter, #numbersWrapper p::first-letter, #lettersWrapper p span::first-letter, #lettersWrapper p::first-letter{
  font-size:17px;
} 

span{
  display:inline-block
}

Below is a portion of the HTML code causing the validation issue:

<div id="lettersWrapper">
<h3 id="MSL">Maritme Signals: Letters</h3>
<div class="textWrapper">
<p>A - <span>Alpha</span>
<br/><img src= (REMOVED)
    alt="I have a diver down; keep well clear at slow speed."
    title="I have a diver down; keep well clear at slow speed."/></p>
<p>B - <span>Bravo</span>
<br/><img src= (REMOVED)
    alt="I am taking in, or discharging, or carrying dangerous goods."
    title="I am taking in, or discharging, or carrying dangerous goods."/></p>

I'm puzzled as to why it's failing validation. From some research online, there seems to be an indication that chaining elements and then applying the first-letter style isn't permitted according to the specifications. However, this seems odd since the styling is rendering correctly on Chrome.

Answer №1

Make sure to only use one colon for CSS 2.1's pseudo-elements like first-letter. Your code should be structured as follows:

#numbersWrapper p span:first-letter, #numbersWrapper p:first-letter, #lettersWrapper p span:first-letter, #lettersWrapper p:first-letter{
  font-size:17px;
} 

span{
  display:inline-block
}

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

Make the nav tabs in Bootstrap 4 stretch across the entire width of the screen with a bottom border

Looking for assistance with Bootstrap nav nav-tabs? How can I replicate the displayed behavior where the bottom border spans the full width of the screen and the tabs are centered on the page, as shown in this image? https://i.sstatic.net/WNRHB.png ...

Discover the hexadecimal color code generated from an rgba color

Do you know of a service that can determine the final hexadecimal value of an rgba color? For instance, if my body background-color is set to #FF0000 and my header is positioned over it with a background-color of rgba(0,0,0,.7), how can I find out what the ...

Creating a dynamic event set feature with a Collada object in A-Frame for immersive webVR experiences

I've been experimenting with creating a rotating animation on a collada object using the event set component plugin for A-frame. While I've had success with a-box, I'm running into some issues when trying to animate the collada object instea ...

What is the typical method for preserving a specific gap between two lines when the line spacing surpasses the margin?

My workplace provided me with a wireframe that looks like this: https://i.sstatic.net/Qumru.png Description of the image above: Maintain a margin of 10px between the lines and utilize the specified css class .font16. This is what the .font16 class conta ...

Tips for keeping two row headers in place on a table while scrolling:

Check out my fiddle here: https://jsfiddle.net/oed1k6m7/. It contains two td elements inside the thead. thead th { position: -webkit-sticky; /* for Safari */ position: sticky; top: 0; } The code above only makes the first row fixed. How can I make b ...

What is the best way to set up a loop for displaying Chat Bubbles?

Is there a way to create a loop for chat bubbles? I want them to appear on the right when I send a message and on the left when the chat partner replies. How can I implement this loop? This is the code I currently have: <div class="Webview"> &l ...

Align the present domain using XPath

Is there a way, possibly with a newer version of XPath, to make the following code work: //a/@href[not contains("DOMAIN OF THE CURRENT PAGE")] The DOMAIN OF THE CURRENT PAGE should function as a variable that retrieves the domain - similar to something l ...

Develop a JavaScript function to declare variables

I am currently attempting to develop a small memory game where the time is multiplied by the number of moves made by the player. Upon completion of all pairs, a JavaScript function is executed: function finish() { stopCount(); var cnt1 = $("#cou ...

Assistance with Squarespace code injection: Enhancing hover effects on the Flat-Iron template

While browsing the index gallery, I noticed that the Flat-iron template has an opacity change when you hover over images. I'm curious if it's possible to reverse this effect so that the images remain at a low opacity until hovered over to reveal ...

Guide on how to showcase an array in a string format using table rows in JavaScript or jQuery

After making an AJAX call to a PHP database, I receive a String as a result in my script. The format of the string is shown below: array(4) { [0]=> array(3) { ["id"]=> string(3) "181" ["number"]=> ...

Creating a custom navigation bar that elegantly fades away with a smooth animation as you scroll down the page is a must-have

How can I create a navigation bar that disappears when scrolling, with a smooth animation? This is the progress I have made so far. HTML: <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="css/style.css" type="tex ...

Move the button text back to its original position with animation

I have a button with text that shifts to the right by 15px when hovered over. However, when the cursor is removed, the text immediately snaps back instead of smoothly transitioning back to its original position. I tried setting the ease-in-out property but ...

Steps to trigger a JavaScript popup from an iframe window to the parent window

Currently I am developing a web application using JSP with JavaScript. Within the parent window, an iframe is being utilized. The issue arises when a button in the iframe page is clicked, as it opens a popup window within the iframe itself. However, my obj ...

Validation is not being enforced for the input field labeled as 'name' in the form

Can anyone assist me with a form validation issue I'm encountering while working on my project? The validation is functioning correctly for email and institution fields, but it seems to be ignoring the name field. Any suggestions or help would be grea ...

Resizing Image-maps and images on the fly with maphilight.min.js

In relation to the question about dynamically resizing image-maps and images, I found a helpful solution provided by Teemu. I adapted it for my own purposes and you can view my version on jsfiddle. However, when trying to apply this solution to my project ...

Issue with setInterval not functioning in IE10

I am facing an issue with the following code snippet: $(function(){ function load() { $("#queuerefresh").load("1.txt"); } load(); setInterval(load,1000); }); Using: http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jq ...

Is there a way to prevent the ENTER key on the keyboard from interacting with

When visiting http://api.jqueryui.com/datepicker/, I came across the following information: Keyboard interaction While using the datepicker, various key commands are available: PAGE UP: Move to the previous month. PAGE DOWN: Move to the next month. CTRL ...

Obtain the quiz test score in plain text format without any pop-up messages

I'm looking to add an online quiz feature to my blog. Currently, the code I have displays the result score in a popup when the user clicks on "View Results." However, I would like to show the result as text within the form itself, similar to the imag ...

Having trouble loading IE with jQuery isotope

Encountering a common issue on an unfamiliar browser, many still face the challenge. Setting up an isotope grid on websites seems to function seamlessly across various browsers, except for when testing in Internet Explorer using . In this case, the layout ...

When a PHP-generated child element is clicked, jQuery fails to detect it

I'm currently developing a website where I need to dynamically display buttons based on database content. These buttons, when clicked, should send a request to the database and update the page content accordingly. My approach involves using Ajax and ...