简体   繁体   English

CSS在元素项上的样式

[英]CSS Styling on Elements Items

I have some list items and I want the corresponding drop down menu to align to the left, for some elements, and some should remain. 我有一些列表项,并且我希望相应的下拉菜单与某些元素保持左对齐。 (See link .) When you hover over the "more", "opinion", and "lifestyle" link, it aligns to the right and out of the page causing lengthy stuff. (请参阅链接 。)当您将鼠标悬停在“更多”,“意见”和“生活方式”链接上时,它会向右对齐并超出页面范围,从而造成冗长的内容。 I want just those 3 menu lists to align to the left when you hover, while the others not mentioned to remain. 当您将鼠标悬停在上面时,我只希望这三个菜单列表向左对齐,而其他未提及的菜单列表则保持不变。 What can I do to achieve this? 我该怎么做?

After looking through your html I suggest you look for the classes leaf *first leaf* and last leaf and add another class in your CSS that mimics these except float:right . 浏览完html之后,建议您查找类* leaf * first **和lastleaf,并在CSS中添加另一个模拟这些类的类,除了float:right then apply this to the menus you want to float right. 然后将其应用于您要向右浮动的菜单。

If this makes the elements go to far to the right maybe try 如果这样会使元素移到最右边,则可以尝试

position:inherit;
left:-Xpx;

And replace X with the amount of pixels you want it to go left. 并将X替换为您希望它向左移动的像素数量。

On this site 这个网站上

Luck 运气

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

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