[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Problem styling nav (CSS)

Posted on 2013-05-30
3
Medium Priority
?
534 Views
Last Modified: 2013-05-30
I have a horizontal nav, it is the main menu. I want to style it differently than all other a {'s. I've tried adding this to the stylesheet to create a class for the main nav.

#main_nav a {
display:block;
padding:10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color:#ffffff;
font-size: 18px;
text-decoration:none;
}

#main_nav a:hover,a:active
{
background-color:#b4c48d;
}

This is what the nav item looks like:

<div class="main_nav" style="position: absolute; top: 316px; left: 24px; width: 760px; height: 48px;color:#ffffff;">

Should this work?
0
Comment
Question by:J C
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:J C
ID: 39208416
At this point, the nav only responds to changes I make to the stylesheet's

a {
}

but I do not want to affect all hyperlinked text on the page
0
 
LVL 10

Accepted Solution

by:
jtwcs earned 2000 total points
ID: 39208455
The css declarations are referencing an element with an ID of main_nav but the div has a class of main_nav.

You can either change the markup to <div id="main_nav" .... >  or update the css declarations to

.main_nav a {
display:block;
padding:10px;
font-family: Verdana, Arial, Helvetica, sans-serif;
color:#ffffff;
font-size: 18px;
text-decoration:none;
}

.main_nav a:hover, .main_nav a:active
{
background-color:#b4c48d;
}
0
 

Author Comment

by:J C
ID: 39208476
That worked. Thanks for the explanation and your assistance.
0

Featured Post

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question