Willkommen, Gast
Benutzername: Passwort: Angemeldet bleiben:

THEMA: Possible to style a specific answer column?

Possible to style a specific answer column? 1 Jahr 2 Wochen her #94620

  • smiit
  • smiits Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
I have an array question with 6 answer columns.

Is it possible to use CSS styling to modify only the 1st column?

I want to draw a border around it and add shading but leave the remaining 5 columns to the right of it unaffected.

Thanks.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Possible to style a specific answer column? 1 Jahr 2 Wochen her #94637

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 3813
  • Dank erhalten: 683
  • Karma: 328
Add this to the end of template.js:
$(document).ready(function() { 	
	// Add some column-specific classes
	$('.array-flexible-row table.question tr').each(function(i, el){
		$('> *', this).each(function(i, el){ 
			$(el).addClass('col-'+i);
		});
	});
});


And then something like this to the end of template.css:
.array-flexible-row .col-1 {
	background: pink !important;
	border: 1px solid red;
}


Capture_2013-04-05.JPG
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Letzte Änderung: 1 Jahr 2 Wochen her von tpartner. Begründung: Typo
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Folgende Benutzer bedankten sich: smiit

Possible to style a specific answer column? 1 Jahr 2 Wochen her #94655

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 5854
  • Dank erhalten: 716
  • Karma: 222
And only css solution:
.array-flexible-row table.question tbody td:first-of-type  {
	background: pink !important;
	border: 1px solid red;
}
www.w3.org/CSS/Selectors/pseudo-classes/:first-of-type
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Possible to style a specific answer column? 1 Jahr 2 Wochen her #94658

  • tpartner
  • tpartners Avatar
  • OFFLINE
  • LimeSurvey Team
  • Beiträge: 3813
  • Dank erhalten: 683
  • Karma: 328
And only css solution:
Yes, but be aware that it's not supported in IE7 or IE8 - reference.sitepoint.com/css/pseudoclass-firstoftype
Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

LimeSurvey is open-source and run entirely by volunteers so please consider donating to support the project.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Possible to style a specific answer column? 1 Jahr 1 Woche her #94756

  • smiit
  • smiits Avatar
  • OFFLINE
  • Fresh Lemon
  • Beiträge: 2
  • Karma: 0
Thank you both for the clear, timely responses. Tony's .js plus css combo worked perfectly.
Der Administrator hat öffentliche Schreibrechte deaktiviert.

Possible to style a specific answer column? 1 Jahr 1 Woche her #94781

  • DenisChenu
  • DenisChenus Avatar
  • OFFLINE
  • Moderator Lime
  • Beiträge: 5854
  • Dank erhalten: 716
  • Karma: 222
tpartner schrieb:
And only css solution:
Yes, but be aware that it's not supported in IE7 or IE8 -
Maybe selectivizr.com/ can be added ;).

And for give the "Can i use" , i prefer caniuse.com/: caniuse.com/#feat=css-sel3
Because in CC-by-sa 3 ;)
Der Administrator hat öffentliche Schreibrechte deaktiviert.
Moderatoren: ITEd
Ladezeit der Seite: 0.145 Sekunden
Donation Image