score:0
The span is a sibling of the checked input, not a descendant.
See: Adjacent Sibling Combinator
.buttons {
padding: 30px;
}
.buttons input:checked+span {
color: blue;
}
<section class="buttons">
<label>
<input type="radio" name="options" id="option1" checked />
<span>9th grade</span>
</label>
<label>
<input type="radio" name="options" id="option2">
<span>10th grade</span>
</label>
<label>
<input type="radio" name="options" id="option3"/>
<span>11th grade</span>
</label>
<label>
<input type="radio" name="options" id="option4" />
<span>12th grade</span>
</label>
</section>
Source: stackoverflow.com
Related Query
- Javascript: How to use adjacent sibling selector in jss with <input type=radio> // change color when clicked
- How to use custom Input with Formik in React?
- How to correctly use a curried selector function with react-redux's useSelector hook?
- How to use a select input type with redux-form?
- How to use a global parent selector with CSS Modules
- How to style input tag without class with JSS
- How to reload input value in React / Javascript with Virtual DOM?
- How can I use a placeholder with a number input in React?
- How to use JavaScript await on user input in an async function
- How to use Formik with input names that have dots "."?
- How leetcode do this: Read user's input String as multiple JavaScript functions and run a main function with user's input params
- how to use sibling selector css in styled
- How do I use the error prop and css for Input API of Material UI with context
- Javascript veriable selector how to use as
- Material UI Button - How can I use "::first-letter" pseudo element selector with MuiButton class?
- How to use JavaScript with $ inside render() in Reactjs
- How to use SASS parent selector with sass module in react
- How can use material UI Pickers KeyboardDatePicker with DD/MMM/YYYY format or with a custom input field
- How to use Facebook Javascript SDK to login and force re-authentication with React Web and Typescript inside of a component
- How to use Modals with input in react hooks
- How to add class to a div that has adjacent sibling using javascript or react?
- How to use input together with redux?
- How to use React context on search input and share the input with other components?
- How to make the input disabled with z-index in javascript or react?
- How can receive user's input date and match it with the date() javascript function?
- How can I use Map function for an Array with values and another array as a value in Javascript
- How to use refs in React with Typescript
- How can I use multiple refs for an array of elements with hooks?
- How to use callback with useState hook in react
- How to use children with React Stateless Functional Component in TypeScript?
More Query from same tag
- recoil: Duplicate atom key - in nextjs
- Typescript React component with propTypes
- How to fix - Functions are not valid as a React child?
- TypeScript - Type 'Element' is not assignable to type 'ReactChildren'
- Passing javascript values into JSX
- carbon-addons-iot-react bundle size too big
- react upload image and set new ref with it
- Get ref from connected redux component withStyles
- How to create a css vertical line with circles and text on side in reactjs?
- How access Redux store on service worker
- Simulate click event in React with TypeScript material-ui
- Position absolute div hides after going outside of its parent container and into another container
- Justify-items: flex-end; Isn't working for me
- file upload using react-step-builder form with multiple pages
- modify specific redux-form value from custom function callback in react-admin
- Conditional rendering within loops in React JS
- Animate presence not working in next js for exit animations only?
- Proper data fetching for ReactJS components and MobX
- I have to click on my link twice before state is update and styling is changed
- Clone of state with id is changed when state is changed
- Update data from API fetch request with React Hooks?
- ESlint: Parsing error: Unexpected token <
- React Script exits immediate after starting development server using docker run command
- React, NodeJS, Express and Heroku. HTTPS inconsistency error
- Problems with navigation
- Trouble clearing react.useState with clear button
- WebStorm is auto downloading JavaScript typings. How to stop this?
- Jquery vs. New Javascript Frameworks/Libraries (Angular, Ember, React, etc.)
- How to change outline color of Material UI React input component?
- On npm start npm ERR! A complete log of this run can be found in: