Solved

CSS - specify different colour for first list menu?

Posted on 2013-06-03
7
230 Views
Last Modified: 2013-06-03
Hi,
Is there a way I can have the first link "CONTACT US" display in in red?

Thanks,

Andrew


<html>
<head>
<title>Untitled Document</title>

<style type="text/css">


#navbar_bottom {
   margin: 0;
   padding: 0;
   height: 30px; 
}
#navbar_bottom li{
   list-style: none;
   float: right; 
   text-align: center;
   font-size: 12px;
   
}
/* main top menu */
#navbar_bottom li a{
	display: block;
	padding-left: 20px;
	padding-right: 20px;
    color: #ccc;
	height:30px;
	line-height:30px;
	text-decoration: none;
}
/* main top menu hover*/
#navbar_bottom li a:hover {
   color: #000;
}

</style>
</head>

<body>


<div id="menu_bottom"><ul id="navbar_bottom">

<li><a class='main_menu_bot' href=''>CONTACT US</a></li>
<li><a class='main_menu_bot' href=''>JOBS + TRAINING</a></li>
<li><a class='main_menu_bot' href=''>RETAIL</a></li>

 
</ul></div>

</body>
</html>

Open in new window

0
Comment
Question by:sabecs
[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
  • 4
  • 2
7 Comments
 
LVL 9

Expert Comment

by:dustock
ID: 39217403
li:first-child {
color:red;
}

Open in new window

0
 
LVL 14

Expert Comment

by:Juan Ocasio
ID: 39217420
<html>
<head>
<title>Untitled Document</title>

<style type="text/css">


#navbar_bottom {
   margin: 0;
   padding: 0;
   height: 30px;
}
#navbar_bottom li{
   list-style: none;
   float: right;
   text-align: center;
   font-size: 12px;
   
}
/* main top menu */
#navbar_bottom li a{
      display: block;
      padding-left: 20px;
      padding-right: 20px;
    color: #ccc;
      height:30px;
      line-height:30px;
      text-decoration: none;
}
/* main top menu hover*/
#navbar_bottom li a:hover {
   color: #000;
}

</style>
</head>

<body>


<div id="menu_bottom"><ul id="navbar_bottom">

<li><a class='main_menu_bot' href=''>CONTACT US</a></li>
<li><a class='main_menu_bot' href=''>JOBS + TRAINING</a></li>
<li><a class='main_menu_bot' href=''>RETAIL</a></li>

 
</ul></div>

</body>
</html>
0
 
LVL 14

Expert Comment

by:Juan Ocasio
ID: 39217440
Or you can use color:red in another class:

<html>
<head>
<title>Untitled Document</title>

<style type="text/css">


#navbar_bottom {
   margin: 0;
   padding: 0;
   height: 30px;
}
#navbar_bottom li{
   list-style: none;
   float: right;
   text-align: center;
   font-size: 12px;
   
}
/* main top menu */
#navbar_bottom li a{
      display: block;
      padding-left: 20px;
      padding-right: 20px;
    color: #ccc;
      height:30px;
      line-height:30px;
      text-decoration: none;
}
/* main top menu hover*/
#navbar_bottom li a:hover {
   color: #000;
}
 .red{
Color:red;}
</style>
</head>

<body>


<div id="menu_bottom"><ul id="navbar_bottom">

<li><a class='main_menu_bot red' href=''>CONTACT US</a></li>
<li><a class='main_menu_bot' href=''>JOBS + TRAINING</a></li>
<li><a class='main_menu_bot' href=''>RETAIL</a></li>

 
</ul></div>

</body>
</html>
0
Turn Insights into Action

Communication across every corner of your business is essential to increase the velocity of your application delivery and support pipeline. Automate, standardize, and contextualize your communication processes with xMatters.

 

Author Comment

by:sabecs
ID: 39217506
Thanks for your feedback, I tried all suggestions above but none of them worked when testing in IE & Firefox?
0
 
LVL 14

Expert Comment

by:Juan Ocasio
ID: 39217571
Where is the main_menu_bot class defined?
0
 
LVL 14

Accepted Solution

by:
Juan Ocasio earned 500 total points
ID: 39217604
Try this:

<html>
   <head>
      <title>Untitled Document</title>

   <style type="text/css">
      #navbar_bottom {
         margin: 0;
         padding: 0;
         height: 30px;
      }

      #navbar_bottom li{
         list-style: none;
         float: right;
         text-align: center;
         font-size: 12px;
      }
      /* main top menu */
      #navbar_bottom li a{
            display: block;
            padding-left: 20px;
            padding-right: 20px;
          color: #ccc;
            height:30px;
            line-height:30px;
            text-decoration: none;
      }

      /* main top menu hover*/
      #navbar_bottom li a:hover {
         color: #000;
      }

      #navbar_bottom li a.red {
         color: #f00;}
      #navbar_bottom li a.red:hover {
         color: #000;}
   </style>

   </head>

<body>


<div id="menu_bottom">
   <ul id="navbar_bottom">
      <li><a class='main_menu_bot red' href=''>CONTACT US</a></li>
      <li><a class='main_menu_bot' href=''>JOBS + TRAINING</a></li>
      <li><a class='main_menu_bot' href=''>RETAIL</a></li>
   </ul>
</div>

</body>
</html>

Open in new window

0
 

Author Closing Comment

by:sabecs
ID: 39217682
Thanks jocasio123, that's perfect...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …

718 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