Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Style Images in Radio List Answers

Style Images in Radio List Answers 6 Monate 3 Wochen her #111370

  • dweisser
  • dweissers Avatar
  • OFFLINE
  • Gold Lime
  • Beiträge: 205
  • Dank erhalten: 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
Letzte Änderung: 6 Monate 3 Wochen her von dweisser.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Style Images in Radio List Answers 6 Monate 3 Wochen her #111377

  • wilmslow3
  • wilmslow3s Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 12
  • Dank erhalten: 1
  • Karma: 0
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Style Images in Radio List Answers 6 Monate 3 Wochen her #111381

  • dweisser
  • dweissers Avatar
  • OFFLINE
  • Gold Lime
  • Beiträge: 205
  • Dank erhalten: 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.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Style Images in Radio List Answers 6 Monate 3 Wochen her #111382

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 6886
  • Dank erhalten: 925
  • Karma: 275
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Style Images in Radio List Answers 6 Monate 3 Wochen her #111387

  • dweisser
  • dweissers Avatar
  • OFFLINE
  • Gold Lime
  • Beiträge: 205
  • Dank erhalten: 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.
Letzte Änderung: 6 Monate 3 Wochen her von dweisser.
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.330 Sekunden
Donation Image