简体   繁体   中英

hiding a html element on Joomla-Site

I have a Joomla-Based website and as far as I know, the only way to define the first site is to set it in the main menu. For design reasons, I dont want a "Home" button in my main menu. I need a way to hide it, or an other way to define my homepage. From Joomla, I get a ul with li elements for each menu point. I would need a way to remove the first element (best via php on server side). On my opinion js is not an option, just because you would mention it when an element disappears from the menu.... Any suggestions?

You don't have to use CSS to do it, particularly since any changes can mess up the menu item that is being hidden. All you need to do is create a new menu specifically for hidden menu items. You will need menu items for all kinds of stuff - clean URLs for a specific page, controlling modules on a specific page or section/category, or even for page specific CSS. If you don't want all those menu items displaying anywhere you put it in the hidden menu item menu. You don't have to publish the menu in any module so it will never show on the page, but the links and relationships created by the menu items still work.

You could use CSS and the first-child selector to remove the first menu item:

ul#nav li:first-child {
    display: none;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM