简体   繁体   English

在Joomla-Site上隐藏html元素

[英]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. 我有一个基于Joomla的网站,据我所知,定义第一个网站的唯一方法是在主菜单中进行设置。 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. 从Joomla中,我可以得到每个菜单点含li元素的ul。 I would need a way to remove the first element (best via php on server side). 我需要一种方法来删除第一个元素(最好通过服务器端的php)。 On my opinion js is not an option, just because you would mention it when an element disappears from the menu.... Any suggestions? 我认为js不是一个选择,只是因为您会在菜单中某个元素消失时提及它。...有什么建议吗?

You don't have to use CSS to do it, particularly since any changes can mess up the menu item that is being hidden. 您不必使用CSS来执行此操作,尤其是因为任何更改都可能使隐藏的菜单项混乱。 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. 您将需要用于所有内容的菜单项-特定页面的干净URL,控制特定页面或部分/类别甚至页面特定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: 您可以使用CSS和第一个子选择器删除第一个菜单项:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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