Solved

CSS - specify different colour for first list menu?

Posted on 2013-06-03
7
224 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
  • 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article discusses how to create an extensible mechanism for linked drop downs.
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…
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…

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now