Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

.active (css not working)

Featured Replies

Hello friends,

 

In order to highlight the current link of a pagei have used this css

.menu ul li active {
color : #0099cc; 
font-style : normal; 
} 

 

and have use this in html

<ul>
<li class="active"><a href="http://www.webdesigncut.com/">webdesigncut home / <!--[if IE 7]><!--></a> <!--<![endif]--></li>

 

but its not working

 

 

 

 

 

One question mate:

<!--[if IE 7]><!--></a> <!--<![endif]-->

Is it mean that if user agent is not IE7, this tag <a> is not to close?

Try that - you missed the . on the active part in line one :)

 

.menu ul li .active {
color : #0099cc; 
font-style : normal; 
}

  • Author

Try that - you missed the . on the active part in line one :)

 

.menu ul li .active {
color : #0099cc; 
font-style : normal; 
}

 

 

 

 

no still not :mellow:

 

 

 

 

ok i got it solved this wrked

.menu ul li.active a { 
color : #0099cc; 
font-style : normal; 
}

:good:

 

 

  • Author

but problem is when i applied the same class in my body

 body #active #view #main .menu-left.menu ul li a {
color : #0099cc; 
font-style : normal; 
}

it dont work :mellow:

 but problem is when i applied the same class in my body

body .active .menu-left.menu ul li  a {
color : #0099cc; 
font-style : normal; 
}

it dont work  :mellow:

You trying to do a mouseover? if so it's :hover

 

if it's for a link it'll be a:active

  • Author

You trying to do a mouseover? if so it's :hover

 

if it's for a link it'll be a:active

body #active #view #main .menu-left.menu ul li a:active {
color : #0099cc; 
font-style : normal; 
}

still no

 

 

 

body #active #view #main .menu-left.menu ul li a:active {
color : #0099cc; 
font-style : normal; 
}

still no

 

 

 

 

have you tried

 

li a:active

  • Author

have you tried

 

li a:active

 

sorry i dint get u its already li:active 

 

 

body #active #view #main .menu-left.menu ul li a:active {
color : #0099cc; 
font-style : normal; 
}

:unsure:

 

 

What I tend to do is this:

 

<body id="home">
<ul id="nav"><li><a href="#" id="homeNav"></a></li>
<li><a href="#" id="nextNav"></a></li>
</ul>
</body>

body#home a#homeNav {
 /* stuff here */
}

 

That will work.

  • Author

What I tend to do is this:

 

<body id="home">
<ul id="nav"><li><a href="#" id="homeNav"></a></li>
<li><a href="#" id="nextNav"></a></li>
</ul>
</body>

body#home a#homeNav {
 /* stuff here */
}

 

That will work.

 

but i am using include for my menu ??in that case what should i do?mellow.gif

 

 

 

If you are using a PHP "include" for your nav, use either the second or third example here:-

http://www.wickham43.net/highlighthome.php

where the pages have different id:-

<body id="home">
or
<body id="next-page">

which is not in the include file (it's different on every page)

and this is in the include file

<ul id="nav">
<li><a href="#" id="homeNav"></a></li>
<li><a href="#" id="nextNav"></a></li>
</ul>

 

and then you use the matched pairs principle for the styles as shown, which might be

#home li#homeNav a, #next-page li#nextNav a { color: red; }

 

OR

 

a PHP method as the fourth example in my link.

With the method I used, it shouldn't matter what page you're on if you're only using a php include for the navigation. Is the problem because you have a header.php file?

  • Author

If you are using a PHP "include" for your nav, use either the second or third example here:-

http://www.wickham43...ghlighthome.php

where the pages have different id:-

<body id="home">
or
<body id="next-page">

which is not in the include file (it's different on every page)

and this is in the include file

<ul id="nav">
<li><a href="#" id="homeNav"></a></li>
<li><a href="#" id="nextNav"></a></li>
</ul>

 

and then you use the matched pairs principle for the styles as shown, which might be

#home li#homeNav a, #next-page li#nextNav a { color: red; }

 

OR

 

a PHP method as the fourth example in my link.

 

 

 

 

ok i tried this in my menu.inc.php

 

 

<?php
define('THIS_PAGE', 'pagename');

$menuitem1 = '<a href="http://www.webdesigncut.com/">webdesigncut home</a>';
$menuitem2 = '<a href="http://www.webdesigncut.com/webdesign/">Website Design</a>';
$menuitem3 = '<a href="http://www.webdesigncut.com/internetmarketing/">Internet marketing</a>';
$menuitem4 = '<a href="http://www.webdesigncut.com/webhosting/">Website Hosting</a>';
$menuitem5 = '<a href="http://www.webdesigncut.com/graphicdesign/">Graphic design</a>';
$menuitem6 = '<a href="http://www.webdesigncut.com/animations">Animations</a>';
$menuitem7 = '<a href="http://www.webdesigncut.com/companyprofile">Company Profile</a>';

switch (THIS_PAGE) {
case 'webdesigncut home':
$menuitem1 ='<a style="font-style : normal;color: #0099cc;cursor: default;" href="#nogo">webdesigncut home</a>'
break;

switch (THIS_PAGE) {
case 'Website Design':
$menuitem1 ='<a style="font-style : normal;color: #0099cc;cursor: default;" href="#nogo">Website Design</a>'
break;

switch (THIS_PAGE) {
case 'Internet marketing':
$menuitem1 ='<a style="font-style : normal;color: #0099cc;cursor: default;" href="#nogo">Internet marketing</a>'
break;

switch (THIS_PAGE) {
case 'Website Hosting':
$menuitem1 ='<a style="font-style : normal;color: #0099cc;cursor: default;" href="#nogo">Website Hosting</a>'
break;

switch (THIS_PAGE) {
case 'Graphic design':
$menuitem1 ='<a style="font-style : normal;color: #0099cc;cursor: default;" href="#nogo">Graphic design</a>'
break;

switch (THIS_PAGE) {
case 'Animations':
$menuitem1 ='<a style="font-style : normal;color: #0099cc;cursor: default;" href="#nogo">Animations</a>'
break;

switch (THIS_PAGE) {
case 'Company Profile':
$menuitem1 ='<a style="font-style : normal;color: #0099cc;cursor: default;" href="#nogo">Company Profile</a>'
default:
break;
echo '<ul>
<li>'.$menuitem1.'</li>
<li>'.$menuitem2.'</li>
<li>'.$menuitem3.'</li>
<li>'.$menuitem4.'</li>
<li>'.$menuitem5.'</li>
<li>'.$menuitem6.'</li>
<li>'.$menuitem7.'</li>
</ul>';
?>


<div class="menu-left"><!-- Navigation Menu start -->
<div class="menu">

<ul>
<li><a href="http://www.webdesigncut.com/">webdesigncut home / <!--[if IE 7]><!--></a> <!--<![endif]--></li>
<li><a href="http://www.webdesigncut.com/webdesign/">Website Design <span class="style1">/</span> <!--[if IE 7]><!--></a> <!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="http://www.webdesigncut.com/webdesign/smallbusiness">Small Business Websites</a></li>
<li><a href="http://www.webdesigncut.com/webdesign/ecommerce">Ecommerce Website Design</a></li>
<li><a href="http://www.webdesigncut.com/webdesign/cms">CMS Websites</a></li>
<li><a href="http://www.webdesigncut.com/webdesign/databasedriven">Database Driven Websites</a></li>
<li><a href="http://www.webdesigncut.com/webdesign/personal">Personal WebSites</a></li>
<li><a href="http://www.webdesigncut.com/webdesign/siteredesign">Site Redesigns</a></li>
<li><a href="http://www.webdesigncut.com/webdesign/websitemaintenance">Website maintenance</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
<li><a href="http://www.webdesigncut.com/internetmarketing/">Internet marketing <span class="style1">/</span> <!--[if IE 7]><!--></a> <!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="http://www.webdesigncut.com/internetmarketing/searchenginesubmission">Search engine submission</a></li>
<li><a href="http://www.webdesigncut.com/internetmarketing/directorysubmission/">Directory submission</a></li>
<li><a href="http://www.webdesigncut.com/internetmarketing/contentwritting">Content writing</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
<li><a href="http://www.webdesigncut.com/webhosting/">Website Hosting <span class="style1">/</span> <!--[if IE 7]><!--></a> <!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="http://www.webdesigncut.com/webhosting/domainnameregistration">Domain name registration</a></li>
<li><a href="http://www.webdesigncut.com/webhosting/windowshosting">Windows hosting</a></li>
<li><a href="http://www.webdesigncut.com/webhosting/linuxhosting">Linux hosting</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
<li><a href="http://www.webdesigncut.com/graphicdesign/">Graphic design <span class="style1">/</span> <!--[if IE 7]><!--></a> <!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="http://www.webdesigncut.com/graphicdesign/logodesign">Logo design</a></li>
<li><a href="">T-shirt design</a></li>
<li><a href="http://www.webdesigncut.com/graphicdesign/bannerdesign">Banner design</a></li>
<li><a href="http://www.webdesigncut.com/graphicdesign/brochuredesign">Brochure design</a></li>
<li><a href="http://www.webdesigncut.com/graphicdesign/photoretouching">Image retouching</a></li>
<li><a href="http://www.webdesigncut.com/graphicdesign/stationarydesign">Stationary design</a></li>
<li><a href="http://www.webdesigncut.com/graphicdesign/flyerdesign">Flyer design</a></li>
<li><a href="http://www.webdesigncut.com/graphicdesign/webinterfacedesign">Web interface design</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
<!--[if IE 7]><!-->
<!--<![endif]-->
<!--[if lte IE 6]></td></tr></table></a><![endif]-->
<li><a href="http://www.webdesigncut.com/animations">Animations <span class="style1">/</span> <!--[if IE 7]><!--></a> <!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="http://www.webdesigncut.com/animations/webbanneranimations/">Web banner animations</a></li>
<li><a href="http://www.webdesigncut.com/animations/3dlogoanimations">3d logo animations</a></li>
<li><a href="http://www.webdesigncut.com/animations/flashanimations">Flash animations</a></li>
<li><a href="http://www.webdesigncut.com/animations/jqueryanimations">Jquery animations</a></li>

</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
<li><a href="#">Tutorials <span class="style1">/</span> <!--[if IE 7]><!--></a> <!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
<li><a href="http://www.webdesigncut.com/companyprofile">Company Profile <!--[if IE 7]><!--></a> <!--<![endif]-->
<!--[if lte IE 6]><table><tr><td><![endif]-->
<ul>
<li><a href="/contactus/">Contact us</a></li>
<li><a href="http://www.webdesigncut.com/portfolio">Portfolio</a></li>
<li><a href="http://www.webdesigncut.com/payment">How to pay</a></li>
<li><a href="http://www.webdesigncut.com/faqs/">FAQ's</a></li>
<li><a href="http://www.webdesigncut.com/sitemap">Sitemap</a></li>
</ul>
<!--[if lte IE 6]></td></tr></table></a><![endif]--></li>
</ul>
</div>
<!-- / --></div>

 

 

 

 

and used this code inthis page

 

<?php
define('THIS_PAGE', 'webdesigncut home');
include('includes/menu.inc.php');
?>

replacing 

<?php include("includes/menu.inc.php"); ?>

but stll that dont work :huh:

 

 

I haven't checked your code in detail but the first thing I noticed was that you have spaces in the pagename like

'webdesigncut home'

'Website Design'

etc.

 

I don't think that's possible, so try a single word or link them like 'webdesigncut_home'

  • Author

I haven't checked your code in detail but the first thing I noticed was that you have spaces in the pagename like

'webdesigncut home'

'Website Design'

etc.

 

I don't think that's possible, so try a single word or link them like 'webdesigncut_home'

 

 

 

 

i replaced it 

switch (THIS_PAGE) {
case 'webdesigncut_home':
$menuitem1 ='<a style="font-style : normal;color: #0099cc;cursor: default;" href="#nogo">webdesigncut home</a>'
break;

 

 

<?php
define('THIS_PAGE', 'webdesigncut_home');
include('includes/menu.inc.php');
?>

but still not working

 

 

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.