简体   繁体   English

IE7中的CSS问题

[英]CSS issue in IE7

I have simple web page and that banner contains three images. 我有一个简单的网页,该横幅包含三个图像。 I want to expand the banner when different resolutions.my solution is working on Firefox and Chrome but not IE7. 我想在不同的resolutions.my解决方案在Firefox和Chrome上运行但不能在IE7上扩展横幅。

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">

        #left{width:338px; height:103px; float:left; background-image:url('image/banner_left.jpg'); background-repeat:no-repeat; margin:0px; padding:0px;}
        .middle{float:left; background-image:url('image/banner_middle.jpg'); background-repeat:repeat-x; margin:0px; padding:0px; }
        #right{width:620px; height:103px; float:right; background-image:url('image/banner_right.jpg'); background-repeat:no-repeat;margin:0px; padding:0px; }
    </style>
</head>
<body style="margin:0px; padding:0px;">
    <form id="form1" runat="server">        
        <div id="container" class="middle"  style="float:left;">
            <div id="left"></div>
            <div id="middle" class="middle"></div>
            <div id="right"></div>
            <div id="content" style="clear:both; float:left;"></div>
        </div> 
    </form>
</body>
</html>

any idea? 任何想法?

thanks in advance! 提前致谢!

尝试以百分比为单位在.middle中设置width值。

Using your example and assuming you want any content under the banner this is one way you can do it: 使用您的示例并假设您想要横幅下的任何内容,这是您可以做到的一种方法:

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        body{
            margin:0px;
            padding:0px;
        }
        #banner{
            background:url('image/banner_middle.jpg') ;
            background-repeat:repeat-x;
        }
        #left{
            width:338px;
            height:103px;
            float:left;
            background-image:url('image/banner_left.jpg');
            background-repeat:no-repeat;
        }
        #right{
            width:620px;
            height:103px;
            float:right;
            background-image:url('image/banner_right.jpg');
            background-repeat:no-repeat;
        }
        .clearFloat{
            clear:both;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">        
        <div id="banner">
            <div id="left"></div>
            <div id="right"></div>
            <div class="clearFloat"></div>
        </div>
        <div id="content">
            Any content goes here
        </div>
    </form>
</body>
</html>

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

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