Welcome, Guest
Username: Password: Remember me

TOPIC: Style Images in Radio List Answers

Style Images in Radio List Answers 1 month 2 weeks ago #111370

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 204
  • Thank you received: 5
  • Karma: 5
Hi all,
I have a list radio question where the answers are images.

A1 - <img class="selectedImage" src="../surveyassets/images/imagen1.png"/> One
A2 - <img class="selectedImage" src="../surveyassets/images/imagen1.png"/> One
A3 - <img class="selectedImage" src="../surveyassets/images/imagen1.png"/> One

I want to:
Style the selected answer (apply a border).
Style the unselected answers (reduce opacity/grey out).
Hide the radio buttons.

Though this seems straightforward, I'm having trouble with each! It seems like you should be able to select the image like this:

input.checkbox:hover + label > img.selectedImage {
border: 10px solid red;
}

But, the result of this is that only the Label text gets the border. Why not the image? Any help or suggestions as always are much appreciated. Thank you.

Nebraska David
Last Edit: 1 month 2 weeks ago by dweisser.
The administrator has disabled public write access.

Style Images in Radio List Answers 1 month 2 weeks ago #111377

  • wilmslow3
  • wilmslow3's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 9
  • Thank you received: 1
  • Karma: 0
The administrator has disabled public write access.

Style Images in Radio List Answers 1 month 2 weeks ago #111381

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 204
  • Thank you received: 5
  • Karma: 5
Thank you. I have found this as well as some other complicated workarounds. I couldn't get this to work. I think this is overly complicated, no. It seems like a simple CSS problem.

I think perhaps its because I'm using the right selector for my image, so maybe its template dependent - but I've tried everything. Thanks for your post though!

I do have the imagetick javascript workaround implemented so maybe that is interfering with it, but I don't have any javascript errors...I'll keep plugging.
The administrator has disabled public write access.

Style Images in Radio List Answers 1 month 2 weeks ago #111382

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 6334
  • Thank you received: 818
  • Karma: 243
The administrator has disabled public write access.

Style Images in Radio List Answers 1 month 2 weeks ago #111387

  • dweisser
  • dweisser's Avatar
  • OFFLINE
  • Bronze Donor
  • Posts: 204
  • Thank you received: 5
  • Karma: 5
Yeah - nothing:
input[type=checkbox]:checked + label img {
border: 10px solid yellow;
}

Seems like this ought to work, but alas it does not.

EDIT: I found something. There is a .css rule in my template:
fieldset, img {
border:0;
}

I thought if I placed new rules after this, they would override it - but when I remove this rule...I am able to at least partially apply new css. More experimenting to come.
Last Edit: 1 month 2 weeks ago by dweisser.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.206 seconds
Donation Image