使用jQuery指定LI宽度时的幻影高度 [英] Phantom height when specifying the width of a LI using jQuery

查看:159
本文介绍了使用jQuery指定LI宽度时的幻影高度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个简单的 ul li 结构如下:

On a simple ul and li structure like this:

<div id="middle">
    <ul>
        <li>
            <a>
                bridal
            </a>                    
        </li>
        //....
    </ul>
</div>

ul 显示为表格, c $ c> li 作为表单元格。我使用jquery来修复li的宽度,之后他们加载到DOM。

ul is displayed as table and li as table cell. I am using jquery to fix the width of the li, after they are loaded on the DOM. This is to stabilize the width when font family is changed.

但是,在chrome我得到一个幻影高度和宽度 a code>比jQuery计算的大10px +。

But, at chrome I get a phantom height and the the width of a is 10px+ more than the jQuery calculates.

帮助我修复这些问题: http: //jsfiddle.net/qK8Yr/

Help me fix these: http://jsfiddle.net/qK8Yr/

注意:如果我删除了设置宽度的代码,则幻影高度消失。

Note: If I remove the code to set the width, the phantom height goes away.

推荐答案

此类的以下CSS

http:// jsfiddle .net / qK8Yr / 3 /

nav#mainNavigation a
{
cursor: pointer;
font-family: 'Verdana';
font-size: 11px;
font-weight: bold;
display: block;
padding: 3px 0px !important;

}

这篇关于使用jQuery指定LI宽度时的幻影高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆