IE 7负边差错误 [英] IE 7 negative margin error

查看:58
本文介绍了IE 7负边差错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用此代码,TEXT不会显示在IE 7中。我认为它的输入后面?给它一个zindex dosn't帮助,我不能使用position:亲戚,因为它弄乱了其他的东西。
任何想法如何解决?

 <!DOCTYPE html> 
< input />< span style ='margin-left:-50px;'> TEXT< / span>


解决方案

更新的浏览器处理它的确定,但老年人仍然不工作,你期望他们在许多情况下的方式。所以你可能需要使元素成为一个块级元素(这将导致你潜在地需要使用一个浮动,使它回到内联,然后将其定位到表单元素,这是我假设是预期的最终位置。 / p>

此外,z-index只适用于定位的元素。我很惊讶的位置:相对的混乱其他的东西,但位置:绝对不,去修复将是使用{position:relative; left:-50px; z-index:10;}来滑动span。


With this code the "TEXT" doesn't show up in IE 7. I think its behind the input? Giving it a zindex dosn't help, and i can't use position:relative because it messes other stuff up. any ideas of how to fix?

<!DOCTYPE html>
<input/><span style='margin-left:-50px;'>TEXT</span>

解决方案

Margins are not reliable on inline elements. Newer browsers handle it ok, but older ones still don't work the way you expect them to in many cases. So you may need to make the element a block level element (which will then cause you to potentially need to use a float to bring it back inline before positioning it over the form element, which is what I assume is the intended final position.

Also, z-index will only work for elements that are positioned. I'm surprised that position: relative messes other things up, but position: absolute doesn't, my go to fix would be to use { position: relative; left: -50px; z-index: 10; } to slide the span over.

这篇关于IE 7负边差错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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