简体   繁体   English

IE7显示:阻止

[英]IE7 display:block

I have 2 span tags which have a tags in working as buttons for a gallery and to position them i am using display:block. 我有2个span标签,其中有一个标签用作画廊的按钮,并使用display:block定位它们。 Which works fine in all browsers apart from IE7. 在IE7之外的所有浏览器中都可以正常工作。 Both of the button have shifted to the right hand side of the gallery. 两个按钮都移到了画廊的右侧。 Here is the CSS code I am using for them: 这是我为他们使用的CSS代码:

.prv_button{
    float:left;
height:227px;
width:15px;
position:absolute;
display:block;
overflow: hidden;

}

.prv_button a{
background-image:url(../images/gal_prv.jpg);
background-repeat:no-repeat;
height:227px;
width:15px;
display:block;
position:relative;
overflow: hidden;
}

.nxt_button{
height:227px;
width:15px;
float:left;
position:absolute;
display:block;
overflow: hidden;
left:432px;
}

.nxt_button a{
background-image:url(../images/gal_nxt.jpg);
background-repeat:no-repeat;
height:227px;
overflow: hidden;
width:15px;
display:block;
position:relative;
}

let me know if you need any more information. 让我知道您是否需要更多信息。

Thanks. 谢谢。

我必须为IE7使用样式表,所以当使用其他方法为IE7定位样式时,在其他浏览器中不会放弃定位

I am not sure i understand what it is you are trying to achieve but it seems to me you can do this without floating anything, using absolute positioning or having images displayed as backgrounds. 我不确定我是否理解您要实现的目标,但在我看来,您可以使用绝对定位或将图像显示为背景而无需浮动任何内容。 I assume that .outer_gwrap has display:inline-block; 我假设.outer_gwrap具有display:inline-block;

CSS: CSS:

.prv_button{
    display:inline-block;
    vertical-align:top;
    width:15px;
}

.prv_button a{
    vertical-align:top;
}
.prv_button img{
    border-width:0px;
}
.nxt_button{
    display:inline-block;
    vertical-align:top;
    width:15px;
}
.nxt_button a{
    vertical-align:top;
}
.nxt_button img{
    border-width:0px;
}
.outer_gwrap{
    display:inline-block;
    width:834px;
    zoom: 1;
    *display: inline;
}

HTML: HTML:

<div class="gallery" >
            <span class="prv_button">
                <a href=""><img src="../images/gal_prv.jpg"></a>
            </span>
            <div class="outer_gwrap">
                <ul class="inner_gwrap">
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                </ul>
                <ul class="inner_gwrap">
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                    <li><a target="_blank" href=""><img border="0" src=""></a></li>
                </ul>
            </div>
            <span class="nxt_button">
                <a href=""><img src="../images/gal_nxt.jpg"></a>
            </span>
        </div>

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

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