css rule for frontpage only - Joomla! Forum - community, help and support


i have bit of code:

code: select all

body#main {
   margin-top: 75px;


i want work on front page. not on other pages. make class , use suffix menu item. doesn't work here. how solve this?

hi gany.
so, if want add custom styling body on frontpage/default page,
you can try doing in template index.php file. not sure if best solution, think can work you.


code: select all

<?php
$app = jfactory::getapplication();
$menu = $app->getmenu();

if ($menu->getactive() == $menu->getdefault()) {
   echo '<body class="frontpage">';
} else {
echo '<body class="not-frontpage">';
}
?>


code: select all

<style>
.frontpage{  margin-top: 75px; }
 </style>

if not want in template file, can create plugin same.





Comments

Popular posts from this blog

Falang and too many redirects - Joomla! Forum - community, help and support

Infinite loop detected in JErrorInfinite loop detected in JError - Joomla! Forum - community, help and support

logged out from joomla! - Joomla! Forum - community, help and support