为什么这些“跨度”在“a”内。失败使用IE7? [英] Why these "span" inside an "a" fail using IE7?

查看:118
本文介绍了为什么这些“跨度”在“a”内。失败使用IE7?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有代码:

<div class="temperatura">
    <a href="/link/" class="temperatura_localita">
        <span style="padding-left:12px;">
            Text1
        </span>
    </a>

    <a href="/link/" class="temperatura_dettagli">
        <span style="padding-right:70px;">            
            Text2
        </span>
    </a>        
</div>



CSS(含义2)



CSS (meaning 2)

.temperatura
{
    height:34px;
    position:relative;
    background-color:#FF0000;
}

.temperatura_localita
{
    width:50%;
    height:34px;
    line-height:34px;
    float:left;
}

.temperatura_dettagli
{
    width:50%;
    height:34px;
    line-height:34px;
    float:left;
    text-align:right;
}

这是我需要的:


  • 容器 tempatura 链接到 / link / / li>
  • 每个 a 是50%,并且链接有一个填充(左或右);

  • the container temperatura is linked to /link/;
  • each a are 50%, and the link got a padding (left or right);

在Firefox / Chrome / IE8 / IE9上没有问题。在IE7上,增加/减少(水平)窗口,第二个链接得到一个新行。

on Firefox/Chrome/IE8/IE9 there arent problem. On IE7, increasing/deacresing (horizontal) the window, the second link got a new line.

为什么?

推荐答案

我认为这是因为你的50%/ 50%当div的像素计数为奇数时,IE7将第二个链接推送到新行,但在偶数时保持正确的位置。将宽度更改为49%即可解决此问题。

I think this is because of your 50%/50% division. IE7 is pushing the second link to a new line when the pixel count of the div is odd, but maintaining the correct position when it's even. Changing both widths to 49% solves the issue.

这篇关于为什么这些“跨度”在“a”内。失败使用IE7?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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