Solved

CSS style

Posted on 2013-01-14
13
354 Views
Last Modified: 2013-01-16
Dear Experts,
I have a left vertical menu. What I want is that when I'm at the related page, the assosiated box should have diffrent background color and the font color should be also diffrent than others. How can I do that? thank you

My code is here.
#menusol {
	margin:0;
	padding:0;
}

#menusol ul{
	width: 198px;
	margin:0;
	padding:1px;
	border:1px solid #d7e3e5;
}
#menusol li{
	display:marker;
	list-style:none;
	padding-bottom:1px;
}
#menusol li a{
	display:block;
	font:.75em Arial, Geneva, sans-serif;
	font-size:12px;
	font-weight:normal;
	text-align:left;
	color:#FFF;
	text-decoration:none;
	background-color:#0D4B64;
	padding:5px;
	border-left:0px solid #F1AEB6;
}
#menusol li a:hover{
	color:#0D4B64;
	border-left:0px solid #F1AEB6;
	background-color:#FFF;
	font-weight:normal;
}

Open in new window

0
Comment
Question by:Braveheartli
  • 5
  • 5
  • 3
13 Comments
 
LVL 25

Expert Comment

by:Kyle Hamilton
Comment Utility
there are lots of different ways of doing that. Depending on how your site is built some may be better than others. you can do it server side, with javascript, or with css alone. which is better for your site depends on how your site is built.
0
 
LVL 5

Expert Comment

by:Neil_Bradley
Comment Utility
A simple (none php solution) might be to give the body tag of each page its own id, then allocate a style according to each specific page.
For example if a page has a body id called <body id="somePage">
its style might look something like this:
#somePage #menusol li a{
      color:red;
}
Essentially, each page would have its own style.
This way would work however php has some much more efficient solutions for applying current page styles to links.
Cheers,
N
0
 
LVL 1

Author Comment

by:Braveheartli
Comment Utility
I think I haven't explain it clearly.
what I want is to give different background and font color to one of the box of my menu.
There will be no link on this box. Because the user will be already on this page. Thank you
0
 
LVL 25

Assisted Solution

by:Kyle Hamilton
Kyle Hamilton earned 375 total points
Comment Utility
You can apply what Neil is suggesting to any element. It doesn't have to be a link.

But then, if you're hard-coding your pages, you can always just give your box an 'active' class, and define that.

.active{

background-color:blue;
color:white;

}

Open in new window

0
 
LVL 1

Author Comment

by:Braveheartli
Comment Utility
dear kozaiwaniec
that is the anwser that I'm looking for.
However, I don't want to use .active
can I do that like this? copy the complete code, give a different name to css and apply the box that I want to be seen in different color.
0
 
LVL 25

Expert Comment

by:Kyle Hamilton
Comment Utility
im not sure i understand your question.

you dont want to have duplicate css files - you'll give yourself a nightmare trying to maintain that.

why dont you want to use 'active'? Do you want different colors for different boxes? if so, just give them different classes.

can you provide a link to your page?
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:Braveheartli
Comment Utility
dear kozaiwaniec

please check this page
http://www.real.com.tr/Oto_Cocuk_Koltugu.html
as you can see on the left menu, one of the link has red color which shows that they are on the related page.
that is what I'd like to do with the above code. I will modify every page on the menu whic is ok for me.
thank you
0
 
LVL 5

Assisted Solution

by:Neil_Bradley
Neil_Bradley earned 125 total points
Comment Utility
My answer still stands. If you add a unique id to each page, you can target whatever you want to change on each page easy as pie.
EG

#somePage .red{
      color:red;
}


Good luck.
Cheers,
N
0
 
LVL 25

Expert Comment

by:Kyle Hamilton
Comment Utility
you have been provided a number of options. it's not clear at this point what you are asking for if you cant use those options.

you need to provide a link to YOUR page if you want a 'copy and paste' solution.
0
 
LVL 1

Author Comment

by:Braveheartli
Comment Utility
Dear kozaiwaniec
my menu is here
http://www.alaramalaz.com/Untitled-1.html
I want one of the menu link color be diffrent than the others. That will show the users that they are on that page. thank you
0
 
LVL 25

Accepted Solution

by:
Kyle Hamilton earned 375 total points
Comment Utility
If you are hard-coding all the pages, then all you have to do is add an "active" class to the li that is the active page. I applied it to the "Franchise Modeli" li:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Franchise Modeli</title>
<link rel="stylesheet" href="css/menusol.css" type="text/css" />
</head>

<body>
<div class="leftContentsol">

			<div class="leftContentINsol">
                        <div class="leftContentininsol">
                        <div id="menusol">
  
<ul>
<li><a href="etkili-anne-baba-egitimi.html">Ücretsiz Etkili Anne Baba Egitimi</a></li>
<li><a href="metin-cinaroglu-holistic-workshop.html">Ücretsiz Holistic Egitim Takvimi</a></li>
<li><a href="bireysel-programlar.html">Bireysel Sertifika Programlari </a></li>
<li><a href="bireysel-diploma-programlari.html">Bireysel Diploma Programlari </a></li>
<li><a href="business-programlar.html">Business Programlar</a></li>
<li class="active">Franchise Modeli</li>
<li><a href="kampanyalar.html">Ayin Egitim Kampanyasi</a></li>
<li><a href="hayati-degisenler.html">LIVCON ile Hayati Degisenler</a></li>
<li><a href="uyelik.html">Ofis & Sertifikasyon Üyeligi</a></li>
<li><a href="karma-egitim.html">Karma Egitim Modeli</a></li>
<li><a href="uygulama-workshop-takvimi.html">Uygulama Workshop Takvimi</a></li>
<li><a href="butunsel-workshop-takvimi.html">Bütünsel Workshop Takvimi</a></li>
<li><a href="open-frame.html">OpenFrame Workshop Takvimi</a></li>
<li><a href="master-class.html">MasterClass Workshop </a></li>
<li><a href="lem-takvimi.html">LEM Egitim Takvimi</a></li>
<li><a href="karma-egitim.html">Bütünsel Yaklasimimiz </a></li>
<li><a href="makaleler.html">Makaleler</a></li>
<li><a href="videolar.html">Videolar ve Fotograflar   </a></li>               
                        
</ul>	</div>
                        
                        <!-- leftContentinin starts leftContentinin -->
              </div><!-- Ends leftContentinin -->
                        
          
          
          </div>

		
<!-- Ends leftContentinin -->
          <div>

         
        </div>
          </div>
</body>
</html>

Open in new window


in your css file, define the active class:

.active{
  background-color:white;
  color:grey;
  font: .75em Arial, Geneva, sans-serif;
  font-size: 12px;
  font-weight: normal;
  text-align: left;
  padding: 5px;
}

Open in new window

This is the simplest, most basic way of doing it. Modify the html accordingly on every page.
0
 
LVL 5

Expert Comment

by:Neil_Bradley
Comment Utility
I completely agree with kozaiwaniec.
N
0
 
LVL 1

Author Closing Comment

by:Braveheartli
Comment Utility
thank you
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

763 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

12 Experts available now in Live!

Get 1:1 Help Now