Выбор типа элемента внутри класса в CSS

#css #html #class

#css #HTML #класс

Вопрос:

Привет, я пытаюсь оформить элемент ‘type = «radio»‘, но у меня возникли проблемы с доступом к элементу в CSS. Пожалуйста, помогите, спасибо.

HTML

 <label class="questionLabel"><input class="questionInput" type="radio" name="q4" value="Strongly disagree">
  

CSS

 .questionnaireInput radio    {

    width: 25px;
}
  

Ответ №1:

Вы можете использовать селектор атрибутов (при условии, что вам нужен радиоприемник с именем класса «questionInput»):

 .questionInput[type=radio]{
    width: 25px;
}
  

Ответ №2:

Используйте точное название класса с . впереди.

https://www.w3schools.com/cssref/sel_class.asp

 .questionInput {
  width: 25px;
}  
 <label class="questionLabel"><input class="questionInput" type="radio" name="q4" value="Strongly disagree">  

Ответ №3:

используйте селектор атрибутов

 <label class="questionRadio"><input class="questionRadio" type="radio" name="quiz2" value="Male">

.questionRadio[type=radio]{
    width: 15px;
}