Why isn't the CSS class being applied to the checkbox element?

I created a basic demo where the HTML markup was the same, but one extra rule was applied in one case and not in the other. Here is the Markup:

<div class="rc40w1 oform oform-initialized">
  <div class="rc40w5 hide">
    <div class="rc40w3">
      <ul class="chk-ul oform-w1 ovalid rc40open">
        <li>
          <label for="5A0B0A9213D344628F4BBA4029291F4E">
            <input type="checkbox"
              id="5A0B0A9213D344628F4BBA4029291F4E"
              name="5A0B0A9213D344628F4BBA4029291F4E"
              value="5A0B0A9213D344628F4BBA4029291F4E"
              class=" ">
            <span class="obox"></span>
            <span class="rc40label">
              Infrastructure
              </span>
          </label>
        </li>
      </ul>
    </div>
  </div>

Example 1 : Check my code here

https://jsbin.com/supateketa/3/edit?html,css,output https://i.sstatic.net/lKC30.png

If you observe the class="obox", before the pseudo element there is only one class as shown in the screenshot.

In Second Example An extra class is added in this case: :root input+.obox:before, why?

https://jsbin.com/hovaxakeba/edit?html,css,output

https://i.sstatic.net/rKtUP.png

Why is it not added in the first example?

I am curious to know why it is added in one scenario and not in the other.

:root input+.obox:before {
    position: relative;
    left: -2px;
}

Answer №1

Adding an incorrect css selector will cause the specific style block to be disregarded.

In the initial instance, you included the _:-ms-input-placeholder selector before the :root input+.obox:before selector. This is considered an improper selector, which is why the style did not take effect in your first example.

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

How can I make a div extend beyond the boundaries of a bootstrap card?

Working with bootstrap version 4 and devexpress. The dropdown section you see is a creation by devexpress. https://i.sstatic.net/8vdj6.png ...

Customizing skin CSS for DNN Portal and Page images

Currently, I have a unique custom skin that I personally created. It is implemented on multiple portals that I am responsible for managing. My goal is to incorporate the ability for the header image to change based on the specific page being viewed. The he ...

Best approach for adding an image to an HTML help button: which semantic option is most effective?

Is there a way to create an HTML help button that appears as an image? What would be the most appropriate and semantic approach to achieve this? Below are three different solutions I have considered: 1st idea: Using HTML <button class='help&ap ...

Identifying a Mobile Device on a Website: Tips and Tricks

Looking to implement specific CSS rules for mobile devices on my website. The goal is as follows: Design a clickable link for a phone number that is only functional on mobile devices Sample code: <a href="tel:+1234567890">+1234567890</a> (si ...

Is there a more efficient method to gather properties from an object into separate arrays without the need for using `map` twice?

Currently, my code block looks like this: res.json({ dates: rows.map(function (item) { return item.Date }), counts: rows.map(function (item) { return item.NewMembers }) }); While functional, I can't help but feel it is inefficient as the row ...

Show detailed information in a pop-up window

Javascript $(function() { var dmJSON = "clues.json"; $.getJSON( dmJSON, function(data) { var idx=1; $.each(data.details, function(i, f) { var myid = 'mypop'+String(idx); idx++; var $popup="<popu ...

The process of inserting a CSS file into a CodeIgniter project

Hey there, I'm struggling to load a CSS file in Codeigniter. Can someone please guide me on how to do it? Below is an overview of the Codeigniter sample Directory Structure: views models controllers assets a) stylesheets b) javascript c) images Conf ...

A guide to setting a custom icon for the DatePicker component in Material-UI 5

Seeking to incorporate custom Icons from react-feathers, I have implemented a CustomIcon component which returns the desired icon based on the name prop. Below is the code for this component. import React from 'react'; import * as Icon from &apo ...

Is there a way to keep the input field data in my form in next js persist even after the page refreshes?

I am currently developing a form in Next.js and I need the data to persist even after the page is refreshed or reloaded. Unfortunately, local storage does not work with Next.js, so I am exploring other alternatives. Every time I try to use local storage, ...

Achieving functionality with dropdown menus in jQuery

I am facing an issue with a dropdown menu that works perfectly in jsFiddle during testing, but does not function as expected when I run it on my testing server. jsFiddle: http://jsfiddle.net/cyberjo50/39bu8/2/ HTML <!doctype html> <html> < ...

How can you implement a resource response approach in Express.js using an API?

As a newcomer in my journey with expressjs, I'm currently exploring its functionalities. In my controller, I've structured the response as follows: .... res.json({ 'data': { 'user': { 'id': us ...

The issue with Nextjs getStaticPaths is that it is not retrieving data from Firebase Firestore

I'm encountering an issue with fetching dynamic data from firestore in nextjs using getStaticPaths. While rendering the data from firestore with getStaticProps works, I'm facing a problem when trying to access specific item details as it leads me ...

Halt scrolling news feed when hovering over with the mouse

I'm currently working on a news ticker on this jsfiddle, but it's not functioning as I'd like. Here are the issues I'm facing: When I increase the width and height of all the divs, it doesn't work properly as the last divs over ...

NodeJS Streams: Delay in data transfer with Readable.pipe()

My understanding was that Stream.Readable.pipe() would immediately pipe data as it receives it, but I'm facing unexpected results while trying to create my own streams. const { Writable, Readable } = require("stream"); const writable = new ...

Is there a way to enable Tail Recursion Optimization in TypeScript?

const isPositive = (n: number) => n > 0; function fitsIn(dividend: number, divisor: number, count: number, accum: number): number { if (accum + divisor > dividend) { return count; } return ...

Error message triggered by Yubikey in WebAuthn Authentication API

Having trouble with implementing WebAuthn support on a new website, specifically encountering issues during the navigator.credentials.get() call. The client browser being used is Firefox 85.0 on Fedora 33, and the server is Apache httpd also on Fedora 33. ...

Having trouble sending a function as a prop to a child component in React

Something odd is happening, I'm confident that the syntax is correct, but an error keeps popping up: Error: chooseMessage is not a function // MAIN COMPONENT import React, { useState } from 'react' export default function LayoutMain(prop ...

Guide on retrieving the index of the selected row in Ionic 2

I have successfully retrieved data from a URL in JSON format and displayed it on an HTML page. You can see the output in the image below: https://i.sstatic.net/UEVvD.png Now, I am looking to enhance the functionality by allowing users to click on a speci ...

Vuejs method to showcase input fields based on form names

I am working on a Vue.js form component with multiple input fields, but now I need to split it into two separate forms that will collect different user input. Form 1 includes: Name Surname Email with a form name attribute value of form_1 Form 2 i ...

Is there a way to display only the specific child div within the parent div using JavaScript without affecting the others?

   **** Sorry for the lengthy title **** Today I encountered a problem that I would like to discuss with all of you. When I click on a "COMMENT" button, instead of triggering JavaScript code to display a CHILD.div inside the corresponding ...