[英]PHP Joomla Creating a right-aligned root menu item
I have a menu written here which contains root elements and secondary elements. 我在这里编写了一个菜单,其中包含根元素和辅助元素。 I would like to add a root element, and unlike the other root elements, have this element aligned to the right. 我想添加一个根元素,并且与其他根元素不同,此元素向右对齐。 Can I do this using CSS, and if so, how do I apply a css style to the specific menu item element? 我可以使用CSS进行此操作吗?如果可以,如何将CSS样式应用于特定的菜单项元素?
Yes, you can. 是的你可以。 Every menuitem has a different class in this format: itemX , where X is the id of the menuitem. 每个菜单项都具有以下格式的不同类:itemX,其中X是菜单项的ID。
You can set the width of you class="menutop" to 100% : 您可以将class =“ menutop”的宽度设置为100%:
ul#horiznav.menutop, #horiz-menu ul.menutop {
padding: 0 2px;
margin: 0;
position: relative;
z-index:120;
width:100%;
}
and set "float:right" to your specific menuitem, something like: 并将“ float:right”设置为您的特定菜单项,例如:
.menutop .itemX {float:right}
Replacing X for the id of your menuitem. 将X替换为菜单项的ID。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.