Internet explorer 试图把三个div放在同一条线上,一个对另一个,以IE6、IE7、IE8和Firefox为中心

Internet explorer 试图把三个div放在同一条线上,一个对另一个,以IE6、IE7、IE8和Firefox为中心,internet-explorer,firefox,html,Internet Explorer,Firefox,Html,我在这样做时遇到问题: --空间--第1部分左第2部分中央第3部分右--空间-- div1和3包含一个图像,div2包含一个基于ul/li的css下拉菜单。 分区1和3与分区2贴在一起。 总线条水平居中 我可以毫无问题地在Firefox和IE8上实现这一点。 但在IE7和IE6上,这不起作用。 我需要它在所有IE>=6和Firefox浏览器上兼容 非常感谢 好吧,我会制作一个容器div,带有左右填充和左右边距:auto 它的内部有3个具有这种风格的div: width:100px;/* or h

我在这样做时遇到问题:

--空间--第1部分左第2部分中央第3部分右--空间--

div1和3包含一个图像,div2包含一个基于ul/li的css下拉菜单。 分区1和3与分区2贴在一起。 总线条水平居中

我可以毫无问题地在Firefox和IE8上实现这一点。 但在IE7和IE6上,这不起作用。 我需要它在所有IE>=6和Firefox浏览器上兼容


非常感谢

好吧,我会制作一个容器
div
,带有左右填充和左右边距:auto

它的内部有3个具有这种风格的
div

width:100px;/* or how much you want (the sum of all must be <= container width) */
float:left;

宽度:100px;/*或者你想要多少(所有的总和必须是好吧,我会制作一个容器
div
,左右填充,左右边距:auto

它的内部有3个具有这种风格的
div

width:100px;/* or how much you want (the sum of all must be <= container width) */
float:left;
width:100px;/*或您想要多少(所有的总和必须是试试这个:

  • 将当前的“div”元素更改为“span”元素。默认情况下,它们将是内联的并并排呈现
  • 将此内容包装在id为“nav”的“div”中
  • 将“nav”元素的CSS样式设置为包含“margin:0 auto;width:960px;”样式。这将使整个页面居中
  • 确保您正在使用CSS重置来帮助跨浏览器规范化渲染
  • 希望这有帮助

    鲍勃

    更新:以下是一个示例链接:

    试试这个:

  • 将当前的“div”元素更改为“span”元素。默认情况下,它们将是内联的并并排呈现
  • 将此内容包装在id为“nav”的“div”中
  • 将“nav”元素的CSS样式设置为包含“margin:0 auto;width:960px;”样式。这将使整个页面居中
  • 确保您正在使用CSS重置来帮助跨浏览器规范化渲染
  • 希望这有帮助

    鲍勃

    更新:以下是一个示例链接:


    准确地说,根据rcravens给出的答案,代码如下:

    <div style="vertical-align: middle; text-align: center; height: 50px; position: relative;
    background-image: none; top: 0px; left: 0px; right: 0px" class='ui-state-default'>
            <span style="text-align: left; vertical-align: middle; display: inline-block; width: 33%;height: 100%;">
                    <img id="imgLeft" style="float: left; text-align: center; vertical-align: middle;"class='logo' src='' alt='' />
           </span>
           <span style="text-align: center; vertical-align: middle; display: inline-block; width: 33%;">
                    <input type="text" id="txtSearch" style="width: 50%" />
                     <img id="btnGlobalSearch" class="findImage" style="cursor: pointer; vertical-align: middle" src="<%= System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/"%>Images/icons/find.png" />
           </span>
           <span style="text-align: center; vertical-align: middle; display: inline-block; width: 33%;height: 100%;">
                   <img id="imgRight" style="float: right; text-align: center; vertical-align: middle;"  src='' class='logo' alt='' />
           </span>
    </div>
    
    
    图像/图标/find.png“/>
    

    这满足了IE7的需求…

    根据rcravens给出的答案,准确地说,代码如下:

    <div style="vertical-align: middle; text-align: center; height: 50px; position: relative;
    background-image: none; top: 0px; left: 0px; right: 0px" class='ui-state-default'>
            <span style="text-align: left; vertical-align: middle; display: inline-block; width: 33%;height: 100%;">
                    <img id="imgLeft" style="float: left; text-align: center; vertical-align: middle;"class='logo' src='' alt='' />
           </span>
           <span style="text-align: center; vertical-align: middle; display: inline-block; width: 33%;">
                    <input type="text" id="txtSearch" style="width: 50%" />
                     <img id="btnGlobalSearch" class="findImage" style="cursor: pointer; vertical-align: middle" src="<%= System.Web.HttpContext.Current.Request.ApplicationPath.TrimEnd('/') + "/"%>Images/icons/find.png" />
           </span>
           <span style="text-align: center; vertical-align: middle; display: inline-block; width: 33%;height: 100%;">
                   <img id="imgRight" style="float: right; text-align: center; vertical-align: middle;"  src='' class='logo' alt='' />
           </span>
    </div>
    
    
    图像/图标/find.png“/>
    

    这满足了IE7的需求……

    你可以展示一些css,你是如何做到的,你可以展示一些css,你是如何做到的