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
Solved

Problem styling nav (CSS)

Posted on 2013-05-30
3
490 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
  • 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 500 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How do I select this logo using CSS? 6 29
asp Google Map 2 23
Html input text color the frame line 2 19
Hiding Adsense on Mobile Devices 2 25
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

791 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