Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

CSS - specify different colour for first list menu?

Posted on 2013-06-03
7
Medium Priority
?
232 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 15

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 15

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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

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 15

Expert Comment

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

Accepted Solution

by:
Juan Ocasio earned 2000 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

Technology Partners: 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.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
Suggested Courses

636 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