Shoal Summit Solutions › Forums › MSTW League Manager Plugin (& Add-ons) › Team Schedule Colors
- This topic has 8 replies, 3 voices, and was last updated 6 years, 8 months ago by Mark.
-
AuthorPosts
-
April 5, 2018 at 12:24 pm #5186
Good afternoon,
I have successfully gotten the css styling according to the code snippets, but I’m curious as to whether I can color the games according to home/away?
April 5, 2018 at 12:56 pm #5188Yes. The team schedule table rows have tags for home-game and away-game, which allow you to set up whatever CSS rules you choose.
There is also the shortcode argument:
star_home = '*'
(or whatever symbol you choose, maybestar_home='†'
)As well as
star_conf, star_div, star_league
.For example, see the team schedules on the dev site: http://dev.shoalsummitsolutions.com/lm-team-schedules/
April 5, 2018 at 1:00 pm #5189I’ve used the shortcodes (which are great!) and was wondering about the CSS tags.
Here’s a link: http://wpress.kcmsathletics.com/baseball/mckinley-middle-school-baseball/
Thanks!
April 5, 2018 at 1:03 pm #5190So I tried to change the CSS tags from odd, even to home-game, away-game and it didn’t work and I’m wanting to make sure that I did it correctly. Here’s the CSS code that I used:
/*---------------------------------------------- * Styles for the Horace Mann team schedules *----------------------------------------------*/ table.mstw-lm-team-schedule_horace-mann-middle-school thead tr th { background-color: #007500; /* green */ color: #FFFFFF; /* white */ font-weight: bold; border-top: 1px solid #FFFFFF; /* white */ border-bottom: 1px solid #FFFFFF; /* white */ } table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(away-game) { background-color: #FFFFFF; /* white */ color: #007500; /* green */ } table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(home-game) { background-color: #007500; /* green */ color: #FFFFFF; /* white */ } table.mstw-lm-team-schedule_horace-mann-middle-school tbody tr td { border-top: 1px solid #FFFFFF; /* white */ border-bottom: 1px solid #FFFFFF; /* white */ } table.mstw-lm-team-schedule_horace-mann-middle-school a { text-decoration: underline; } table.mstw-lm-team-schedule_horace-mann-middle-school a:hover { text-decoration: none; } table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(away-game) a, table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(away-game) a:hover, table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(away-game) a:visited, table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(away-game) a:active { color: #007500; /* green */ } table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(home-game) a, table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(home-game) a:hover, table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(home-game) a:visited, table.mstw-lm-team-schedule_horace-mann-middle-school tr:nth-child(home-game) a:active { color: #FFFFFF; /* white */ }
Link: http://wpress.kcmsathletics.com/baseball/horace-mann-middle-school-baseball/
April 5, 2018 at 1:22 pm #5191nth-child won’t work here. Home and away games aren’t typically ‘nth children’. There could be 3 home games in a row followed by 4 away games. Try just using home-game and away-game in your selectors.
-Mark
April 5, 2018 at 1:29 pm #5192Just before you replied I figured it out. I took out the entire tr:nth-child argument and just changed it to .home-game/.away-game.
/*---------------------------------------------- * Styles for the Horace Mann team schedules *----------------------------------------------*/ table.mstw-lm-team-schedule_horace-mann-middle-school thead tr th { background-color: #007500; /* green */ color: #FFFFFF; /* white */ font-weight: bold; border-top: 1px solid #FFFFFF; /* white */ border-bottom: 1px solid #FFFFFF; /* white */ } table.mstw-lm-team-schedule_horace-mann-middle-school .away-game { background-color: #FFFFFF; /* white */ color: #007500; /* green */ } table.mstw-lm-team-schedule_horace-mann-middle-school .home-game { background-color: #007500; /* green */ color: #FFFFFF; /* white */ } table.mstw-lm-team-schedule_horace-mann-middle-school tbody tr td { border-top: 1px solid #FFFFFF; /* white */ border-bottom: 1px solid #FFFFFF; /* white */ } table.mstw-lm-team-schedule_horace-mann-middle-school a { text-decoration: underline; } table.mstw-lm-team-schedule_horace-mann-middle-school a:hover { text-decoration: none; } table.mstw-lm-team-schedule_horace-mann-middle-school .away-game a, table.mstw-lm-team-schedule_horace-mann-middle-school .away-game a:hover, table.mstw-lm-team-schedule_horace-mann-middle-school .away-game a:visited, table.mstw-lm-team-schedule_horace-mann-middle-school .away-game a:active { color: #007500; /* green */ } table.mstw-lm-team-schedule_horace-mann-middle-school .home-game a, table.mstw-lm-team-schedule_horace-mann-middle-school .home-game a:hover, table.mstw-lm-team-schedule_horace-mann-middle-school .home-game a:visited, table.mstw-lm-team-schedule_horace-mann-middle-school .home-game a:active { color: #FFFFFF; /* white */ }
Result: http://wpress.kcmsathletics.com/baseball/horace-mann-middle-school-baseball/
For those trying to stumble or are new to CSS, I found a great website that will help: https://www.w3schools.com/cssref/default.asp
April 5, 2018 at 1:42 pm #5193Good for you! And yes, that is a great website. Seems like I end up there whenever I want to look something up, like nth-child say.
May 25, 2018 at 12:02 pm #5275what would your selectors be if you just wanted different colors for odd/even rows?
May 25, 2018 at 8:15 pm #5276Look at this code snippet. It’s for team rosters but the same idea works for all the MSTW tables.
tr:nth-child(odd)
andtr:nth-child(even)
are what you’re looking for. -
AuthorPosts
- You must be logged in to reply to this topic.