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 trial

PHP Build a Simple PHP Application Creating the Menu and Footer Adding Active States to the Navigation

melissa brown
melissa brown
4,670 Points

how does the echo on work?

i just wanted to get a better understanding of this 'echo on' function. how does it know to underline it. is it somewhere in the css? if so where. what if i wanted it to highlight would i change the css or use a different echo function? why do we have to use php for this couldnt we do this with css. eg like the hover class?

1 Answer

Damien Watson
Damien Watson
27,419 Points

Hi Melissa,

'echo on' adds the classname 'on' to the element. I downloaded the project files and had a look at the css. There is a class there for 'on', I believe it is at line ~527:

.header .nav li.on a {text-decoration: underline;}

To make this a background colour instead, remove the 'text-decoration' and add the background colour, something like :

.header .nav li.on a { background-color:orange; }