0

i made p tag and input type radio is in there

<p class="item-3">
  <input id="fid-1" type="radio" name="globalType">Hey
</p>

How can i make "Hey" red with out label? i already tried this

.item-3 input[type="radio"]:checked + p.item-3
gb yoon
  • 15
  • 3
  • See this: https://stackoverflow.com/a/1014958/17175441 . You may also place the `Hey` inside a span tag and then target that. – aerial Dec 07 '21 at 04:57

1 Answers1

0

Create a span element, and contain the 'hey' within the span element. This will create an inline element that you can then target with CSS.

If you are using multiple, use a class. If single, just an ID is fine.

CSS:

.hey {
    color: red;
}

HTML:

<p class="item-3">
  <input id="fid-1" type="radio" name="globalType"><span class='hey'>Hey</span>
</p>
Oliver Kucharzewski
  • 2,523
  • 4
  • 27
  • 51