Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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; }