Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMatthew Smart
12,567 Points<?php if ($section == "shirts"){echo "on";}?>
how is the term 'echo "on" ' relating to css format?
Lucas Santos
19,315 PointsIt links to the CSS because you are using the echo command (which prints a word) inside the class of the element (where it would say class="<?php if ($section == "shirts"){echo "on";}?>")
. So in your CSS you already have a class set to .on with some styling applied.
So in other words you print that word "on" into the class and setting it to the class of "on".
Jason Anello
Courses Plus Student 94,610 PointsLucas,
You should post your comment as an answer.
Lucas Santos
19,315 Pointsrite forgot
3 Answers
Lucas Santos
19,315 PointsIt links to the CSS because you are using the echo command (which prints a word) inside the class of the element (where it would say class="<?php if ($section == "shirts"){echo "on";}?>")
. So in your CSS you already have a class set to .on with some styling applied. So in other words you print that word "on" into the class and setting it to the class of "on".
kylia seza
554 Pointsit's when you click on the nav button like shirt, the shirt page verify if section = shirt then active navbar button color is actived else is not activated so the css is not applied.
Matthew Smart
12,567 PointsThanks for answering guys, i understand it now, just the video didn't explain it like that. :)
Matthew Smart
12,567 PointsMatthew Smart
12,567 PointsIm understanding php, also understanding html and css really good. But echo "on" i would imagine would just print out 'on' on the page, so how does it link to css?