css - 菜单三 Angular 形/箭头问题(纯 CSS)

标签 css

我在菜单项旁边有一个三 Angular 形,使用纯 CSS。它在 Internet Explorer 和 Firefox 中完美运行,但 Chrome 会裁剪箭头的底部。以下是该问题的一些屏幕截图:

Screenshot of menu in Firefox
Screenshot of menu in Chrome
Screenshot of menu in Internet Explorer 9

这是我正在使用的 CSS:

/*menu arrows */

.arrowsprite {
    width:0px; 
    height:0px; 
    border-left:5px solid transparent;
    border-right:5px solid transparent;
    border-top:5px solid #444444;
    font-size:0px;
    line-height:0px;
    top:-2px;
    position:relative;
}

.arrowspriteselected {
    width:0px; 
    height:0px; 
    border-left:5px solid transparent;
    border-right:5px solid transparent;
    border-top:5px solid #fff;
    font-size:0px;
    line-height:0px;
    top:-2px;
    position:relative;
}

.leftish li:hover .arrowsprite {
    border-top:5px solid #444444;
}


.leftish li:hover .arrowspriteselected {
    border-top:5px solid #444444;
}

HTML 是:

<li>Wanted <span class="arrowsprite"></span></li>

有人在我的 CSS 中看到任何明显的问题吗?

最佳答案

尝试为您的 .arrowsprite 规则将 display 设置为 inline-block。参见 this fiddle for an example .

.arrowsprite {
    width:0px;      
    height:0px;      
    border-left:5px solid transparent;     
    border-right:5px solid transparent;     
    border-top:5px solid #444444;     
    font-size:0px;     
    line-height:0px;     
    top:-2px;     
    position:relative;
    display:inline-block;
}

它在 Chrome 14.0.803.0 dev 中为我工作。

关于css - 菜单三 Angular 形/箭头问题(纯 CSS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6638743/

相关文章:

javascript - 隐藏父 block (显示:none) if child element content text

css - 如何在剑道 ui 网格中显示长单元格值的省略号?

html - 如何将背景设置为div

尽管我使用的是供应商前缀,但 CSS 动画在 Firefox 或 Safari 中不起作用

jquery - 使用 jquery 关闭可折叠菜单

javascript - 在循环中显示 HTML 元素

javascript - 如何通过更改 css 高度和宽度来制作小加载圆?

javascript - 当被其他 flex 元素包围时,容器中的中心 flex 元素

Css - 对齐 <Div>

HTML/CSS 将 DIV 对齐到页面底部和屏幕 - 以先到者为准