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

Orestis Pouliasis
Orestis Pouliasis
5,561 Points

Help with customizing a CSS main navigation menu

I am having some trouble customizing a navigation bar code that I found in the Internet. I was wondering if you could help me. The code:

<style type="text/css">
body {
background-color:#111;
margin:0px 0px;
padding:50px; 
}

#shutter-menu {
font:normal 12px 'Trebuchet MS',Arial,Sans-Serif;
color:white;
text-transform:uppercase; 
}

#shutter-menu ul {
height:50px;
margin:0px 0px;
padding:0px 0px;
overflow:hidden; 
}

#shutter-menu li {
float:left;
display:inline;
list-style:none;
margin:0px 0px;
padding:0px 0px; 
}

#shutter-menu a,
#shutter-menu a:before {
display:block;
margin:0px 0px;
padding:0px 30px;
line-height:50px;
color:white;
text-decoration:none;
background-color:#900;
background-image:-webkit-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
background-image:-moz-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
background-image:-ms-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
background-image:-o-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
background-image:linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);
-webkit-box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
-moz-box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
box-shadow:inset 0px 1px 0px rgba(255,255,255,0.1);
position:relative;
-webkit-transition:all 0.3s ease-in-out;
-moz-transition:all 0.3s ease-in-out;
-ms-transition:all 0.3s ease-in-out;
-o-transition:all 0.3s ease-in-out;
transition:all 0.3s ease-in-out;
}

#shutter-menu a:before {
content:attr(data-clone);
position:absolute;
top:100%;
left:0px;
display:block;
background-color:white;
background-image:-webkit-linear-gradient(top, #ddd, white);
background-image:-moz-linear-gradient(top, #ddd, white);
background-image:-ms-linear-gradient(top, #ddd, white);
background-image:-o-linear-gradient(top, #ddd, white);
background-image:linear-gradient(top, #ddd, white);
border-top:2px solid rgba(0,0,0,0.2);
color:#333; 
}

#shutter-menu a:hover {
margin-top:-50px;
margin-bottom:1px;
}
</style>

<nav id="shutter-menu">
<ul>
<li><a href="#" data-clone="Home">Home</a></li>
<li><a href="#" data-clone="About">About</a></li>
<li><a href="#" data-clone="Portfolio">Portfolio</a></li>
<li><a href="#" data-clone="Comments">Comments</a></li>
<li><a href="#" data-clone="Contact">Contact</a></li>
</ul>
</nav>

I want to make the color of the bar from red to a blue-green color (#006699, to be more specific). You can see how it looks in this HTML/CSS tester:http://www.csgnetwork.com/htmlcodetest.html

Thanks in advance!

5 Answers

Wayne Priestley
Wayne Priestley
19,579 Points

Try something like this,

background-color:#033362;
background-image:-webkit-linear-gradient(top, #00688B 0%, #006699 50%, #033362 50%, #006699 100%);

Hope this helps.

Wayne Priestley
Wayne Priestley
19,579 Points

If you want it all the same colour without the gradient, remove all the background-image code and just change background-color to #006699

Wayne Priestley
Wayne Priestley
19,579 Points

Hi ORESTIS,

It doesn't look like you have the code to change the grey background. It's actually an image, not code.

Hope this helps.

Wayne Priestley
Wayne Priestley
19,579 Points

You could add your own image.

Orestis Pouliasis
Orestis Pouliasis
5,561 Points

Could you please tell me what to do, I am completly ignorant of CSS. (P.S. The mouseover is fine, just the red needs to be changed.)

Wayne Priestley
Wayne Priestley
19,579 Points

If you click on the link you supplied in your first post, there isn't actually any red in the menu.
Are you talking about a different website?

Orestis Pouliasis
Orestis Pouliasis
5,561 Points

The link I supplied was to check out the actual code and see how it looks like. You paste the code in the box and press "Test the HTML code", so as to see the actual menu.

Orestis Pouliasis
Orestis Pouliasis
5,561 Points

Wayne could you please help me with an another CSS problem? I have a visual bug in an other blog in the main nav bar (Blogger CMS platform). I can add CSS lines with the Add CSS function.

Wayne Priestley
Wayne Priestley
19,579 Points

Now I see what it is.

This is the code you need to change.

background-image:-webkit-linear-gradient(top, #900 0%, #6A0808 50%, #620303 50%, #6A0808 100%);

You also need the update the other prefixed lines to match this one once your done.

Orestis Pouliasis
Orestis Pouliasis
5,561 Points

So I changed the 3 color values to my prefencial color value, and it now looks like this:

background-image:-webkit-linear-gradient(top, #900 0%, #006699 50%, #006699 50%, #006699 100%);

But it then gets colored half blue, half red (Check out how it looks: http://imgur.com/qOVOjuK) Something else needs to be changed as well.

Orestis Pouliasis
Orestis Pouliasis
5,561 Points

Wayne Priestley = Best Answer Thanks for your help!

Wayne Priestley
Wayne Priestley
19,579 Points

Can you explain a little more and give me a link

Orestis Pouliasis
Orestis Pouliasis
5,561 Points

Yes of course. Link: http://kapistrinews.blogspot.gr/ As you can see, there is no mouse-over effect, and if you click on a link, it looks like this: http://imgur.com/i2u53fw So basically, what is needs to be fixed is the problem seen in the image in the link and the missing mouse-over effect (just a simple highlighting when you mouse over it, something simple). Thanks in advance! EDIT: The HTML element to select it is : "Label1"

Wayne Priestley
Wayne Priestley
19,579 Points

You need to add padding to the span of `visited and you also need to add some pseudo classes to the navigation to get the mouse over effects you want.

I'd say you should contact whom ever is in charge of the maintenance of the website to do this for you.
It's not just a straight forward changing or addition of a #label,there are many different classes involved and its not really something that should be done without access to the website code.

Orestis Pouliasis
Orestis Pouliasis
5,561 Points

I'm in charge of it, I can make any edit neccesary to the code, but what excactly do I have to do? Is there any guide out there?

Wayne Priestley
Wayne Priestley
19,579 Points

ORESTIS,

If you post you email address I can email you about the changes needed, i will delete your post once i have your email address.