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

CSS

need help with drop down menu

Please take a look at my code pen below:

http://codepen.io/tbeckett24/pen/lvqEi

The drop down menu is working fine, but now I want to style it better.

I now want to style the actual drop down menus. The style I want to achieve is that when you hover over a drop down menu link I want the text to turn black and the background to turn orange with a solid border on the left maybe 4px in black.

How would I achieve this I'm struggling. Thanks in advance for any help

To start, your code is very messy, you have lots of things in separate classes, rather than grouped together, so it is very difficult to review your code, you also have some random extra characters in your HTML that are not needed.

A great way to learn is to experiment, rather than to just be given the answers you need to achieve a website that looks how you want it. Try studying http://www.w3schools.com/cssref/sel_hover.asp

1 Answer

There is always room for improvement, but sometimes it is best to see a solution to gain understanding. Try replacing your last three rules with these and see if it gets you down the road a bit:

ul#menu li ul.sub-menu li {
  padding-bottom:0;
  border-bottom: 2px dotted #8B8484;
  text-align: left;
}

ul#menu li ul.sub-menu li a {
  display: block;
  padding: 18px 10px 18px 20px;
}

ul#menu li ul.sub-menu li a:hover {
  background-color: #FF8F45;
  border-left: 4px solid #000;
  padding-left: 16px;
}

Lynde

Thanks a lot for your code its really helped me. Thanks again for taking the time.

You're welcome. If my answer helped you, please choose mine as the best answer so I can earn points for it. Thanks!