草庐IT

html - 高度 :100% not working in Internet Explorer

coder 2023-07-31 原文

我对 Internet Explorer 中的 CSS 属性 height:100% 有疑问。

height:100% 在 IE 中无效,但在 Firefox 和 Chrome 中有效。

HTML 文件:

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<html style="height:100%;">

<head>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="style.css" type="text/css" />
</head>

<body>
    <div id="menu_neu">
        <ul id="topNav">
            <li class="current"><a href="#section-1">SECTION 1</b></a>
            </li>
            <li><a href="#section-2">SECTION 2 </b></a>
            </li>
        </ul>
    </div>
    <div id="wrapper">
        <!--SECTION- 1 .....................................................................................................................................-->
        <div class="section" id="section-1">SECTION - 1
            <div style="height:100%;" id="intro">
                <div class="story">
                    <div class="bg1"></div>
                    <div class="bg2"></div>
                    <div class="bg3"></div>
                    <div class="float-left" style="margin-top:120px; width:500px;">
                         <h2>HEIGHT 100% works in Chrome and Firefox,<br> <b>but not in IE!</b></h2>

                        <div id="s1Pfeil1" style="padding-top:120px;padding-left:255px;"> <a href="#second" title="Next Section"><img src="images/icon_down_normal.png" alt="Next" /></a>

                        </div>
                        <!--/box-links-->
                    </div>
                    <!--/float-left-->
                </div>
                <!--./story-->
            </div>
            <!--/intro-->
            <div style="height:100%;" id="second">
                <div class="story">
                    <div class="bg1_2"></div>
                    <div class="bg2_2"></div>
                    <div class="bg3_2"></div>
                    <div class="float-right" style="margin-top:45px; width:500px;">
                            <h2>HEIGHT 100% works in Chrome and Firefox,<br> <b>but not in IE!</b></h2>

                        <div id="s1Pfeil2" style="padding-top:200px;padding-left:225px;">   <a href="#intro" title="Before Section"><img src="images/icon_up_normal.png" alt="Next" /></a>&nbsp;&nbsp;</a>  <a href="#third" title="Next Section"><img src="images/icon_down_normal.png" alt="Next" /></a></a>&nbsp;&nbsp;</a>
                        </div>
                        <!--/box-links1-->
                    </div>
                    <!--/float-right-->
                </div>
                <!--./story-->
            </div>
            <!--#second-->
            <div id="third" style="height:100%;">
                <div class="story">
                    <div class="bg1_3"></div>
                    <div class="bg2_3"></div>
                    <div class="bg3_3"></div>
                    <div class="float-left" style="margin-top:80px; width:500px;">
                            <h2>HEIGHT 100% works in Chrome and Firefox,<br> <b>but not in IE!</b></h2>

                        <div id="s1Pfeil3" style="padding-top:200px;padding-left:225px;">   <a href="#second" title="Next Section"><img src="images/icon_up_normal.png" alt="Next" /></a>

                        </div>
                        <!--/box-links2-->
                    </div>
                    <!--/float-left-->
                </div>
                <!--.story-->
            </div>
            <!--#third-->
        </div>
        <!--/section1-->
        <!--SECTION- 2 BRANDSTIFTER..................................................................................................................................-->
        <div class="section" id="section-2">SECTION -2
            <div id="intro_bs">
                <div class="story_bs">
                    <div class="bg1_bs"></div>
                    <div class="bg2_bs"></div>
                    <div class="bg3_bs"></div>
                    <div class="float-left_bs" style="margin-top:50px; width:600px;">
                            <h2>HEIGHT 100% works in Chrome and Firefox,<br> <b>but not in IE!</b></h2>

                        <div id="s2Pfeil1" style="padding-top:-50px;padding-left:305px;"> <a href="#second_bs" title="Next Section"><img src="images/icon_down_normal.png" alt="Next" /></a>

                        </div>
                        <!--/box-links-->
                    </div>
                    <!--/float-left_bs-->
                </div>
                <!--.story-->
            </div>
            <!--#intro-->
            <div id="second_bs">
                <div class="story_bsc">
                    <div class="bg1_2_bs"></div>
                    <div class="bg2_2_bs"></div>
                    <div class="bg3_2_bs"></div>
                    <div class="float-right_bs" style="margin-top:120px; width:500px;">
                            <h2>HEIGHT 100% works in Chrome and Firefox,<br> <b>but not in IE!</b></h2>

                        <div id="s2Pfeil2" style="padding-top:80px;padding-left:305px;"><a href="#intro_bs" title="Next Section"><img src="images/icon_up_normal.png" alt="Next" /></a>&nbsp;&nbsp;<a href="#third_bs" title="Next Section"><img src="images/icon_down_normal.png" alt="Next" /></a>
                        </div>
                    </div>
                </div>
                <!--.story-->
            </div>
            <!--#second-->
            <div id="third_bs">
                <div class="story_bsc">
                    <div class="bg1_3_bs"></div>
                    <div class="bg2_3_bs"></div>
                    <div class="bg3_3_bs"></div>
                    <div class="float-right_bs" style="margin-top:120px; width:500px;">
                            <h2>HEIGHT 100% works in Chrome and Firefox,<br> <b>but not in IE!</b></h2>

                        <div id="s2Pfeil3" style="padding-top:100px;padding-left:225px;">   <a href="#second_bs" title="Next Section"><img src="images/icon_up_normal.png" alt="Next" /></a>

                        </div>
                    </div>
                </div>
                <!--.story-->
            </div>
            <!--#third-->
        </div>
        <!--/section-2-->
    </div>
    <!--/wrapper-->
    <div class="suche">
        <form class="search" action="" method="post">
            <label for="search-box">Search:</label>
            <input id="search-box" type="text" name="search" onclick="search_bigger();" onblur="search_smaller();">
        </form> <a href="http://www.facebook.com/BrandortMarketingKommunikationsGmbh" title="Werde Fan von Brandort. auf Facebook" alt="Werde Fan von Brandort. auf Facebook" target="_blank"><div class="herz"></div></a><a href="images/icon_quicklinks_phone_hover_big.png" rel="lightbox" title="So erreichen Sie uns" alt="So erreichen Sie uns"><div class="telefon"></div></a>

    </div>
    <div class="css-panes">
        <div style="display: block;"></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>

CSS 文件:

html{
    height:100%;
}

body{
    font-family: 'universal_light';
    margin: 0;
    min-width: 980px;
    padding: 0;
    line-height:2em;
    background-color: #f6aa27;
    height: 100%;

}

p{
    margin: 0 0 20px 0; 
}

p, ul{
    font-family:'universal_light';
    font-weight:normal;
    font-size:16px;
}

img{
    border: 0;
}

h1, #pixels{
    font-family:"Museo 900", Verdana, serif;
    font-size-adjust:0.40;
    font-weight:700;
    font-style:normal;
}

h2{
    font-family: 'universal_black';
    color:#000000;
    font-size:30px;
    font-weight:normal;
}

#wrapper{
    height: 100%;
}

#header h1, #pixels{
    color: #48941A;
}



#nav{
    list-style: none;
    position: fixed;
    right: 20px;
}

#nav li{
    margin: 0 0 15px 0; 
}

#nav_bs{
    list-style: none;
    position: fixed;
    right: 20px;
}

#nav_bs li{
    margin: 0 0 15px 0; 
}

#nav_bsa{
    list-style: none;
    position: fixed;
    right: 20px;
}

#nav_bsa li{
    margin: 0 0 15px 0; 
}

#header, #intro, #second{
    width: 100%;
}



/*hier wurde "fix" nach der "no-repeat" gelöscht*/
#intro{
    background-color:#f6aa27;
    margin: 0 auto;
    padding: 0;
    height: 1200px;
    width:100%;
    border-style:solid;
    border-width:5px;

}



/*hier wurde "fix" nach der "no-repeat" gelöscht*/
#intro .bg1{

    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;
    margin-top: -26px;
    margin-left: 66px;

}
/*hier wurde "fix" nach der "no-repeat" gelöscht*/
#intro .bg2{

    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}
#intro .bg3{
    background: url(images/kohle.png) 50% 0 no-repeat fixed;
    width: 1000px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}

#second{
    background:url(images/bg1.jpg) 50% 0 no-repeat;
    background-color:#f6aa27;
    color: #D3D3D3;
    height: 100%;
    min-height: 100%;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
    border-style:solid;
    border-width:5px;
}

#section-2{
background-color:#D3D3D3;
}

#second .bg1_2{
    background:url(images/second/feurig.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;
    margin-left: 143px;
    margin-top: -10px;

}

#second .bg2_2{
    background:url(images/second/handschrift.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}

#second .bg3_2{
    background:url(images/second/brandeisen.png) 50% 0 no-repeat fixed;
    width: 900px;
    position: absolute;
    height: 100%;
    margin: 0 auto;
    padding: 0;

}


#third{
    background:url(images/bg1.jpg) 50% 0 no-repeat;
    background-color:#f6aa27;
    color: #000000;
    height: 100%;
    min-height: 100%;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
        border-style:solid;
    border-width:5px;
}

#third .bg1_3{
    background:url(images/third/handschrift.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}
#third .bg2_3{
    background:url(images/third/feurig.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;
}

#third .bg3_3{
    background:url(images/third/seil.png) 50% 0 no-repeat fixed;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;
}

#fifth{
    background: #ccc;
    height: 400px;
    margin: 0 auto;
    padding: 40px 0 0 0;
}



#header, #intro_bs, #second_bs{
    width: 100%;
}

#intro_bs{
    background:url(images/bg2.jpg) 50% 0 no-repeat;
    background-color:#c9cacc;
    color: #000000;
    height: 900px;
    margin: 0 auto;
    padding: 0;
        border-style:solid;
    border-width:5px;

}

#intro_bs .bg1_bs{
    background:url(images/intro_bs/mitarbeiter.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}

#intro_bs .bg2_bs{
    background:url(images/intro_bs/feurig.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}
#intro_bs .bg3_bs{
    background:url(images/intro_bs/handschrift.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;
}

#second_bs{
    background:url(images/bg2.jpg) 50% 0 no-repeat;
    background-color:#c9cacc;
    color: #000000;
    height: 950px;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
        border-style:solid;
    border-width:5px;
}

#second_bs .bg1_2_bs{
    background:url(images/second_bs/feurig.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}

#second_bs .bg2_2_bs{
    background:url(images/second_bs/handschrift.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}

#second_bs .bg3_2_bs{
    background:url(images/second_bs/steffen.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 950px;
    margin: 0 auto;
    padding: 0;
    margin-left: -121px;


}


#third_bs{
    background:url(images/bg2.jpg) 50% 0 no-repeat;
    background-color:#c9cacc;
    color: #000000;
    height: 950px;
    margin: 0 auto;
    padding: 0;
    overflow: hidden;
        border-style:solid;
    border-width:5px;
}

#third_bs .bg1_3_bs{
    background:url(images/third_bs/feurig.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}
#third_bs .bg2_3_bs{
    background:url(images/third_bs/handschrift.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 900px;
    margin: 0 auto;
    padding: 0;

}
#third_bs .bg3_3_bs{
    background:url(images/third_bs/mike.png) 50% 0 no-repeat;
    width: 900px;
    position: absolute;
    height: 950px;
    margin: 0 auto;
    padding: 0;
    margin-left: -121px;
    margin-top: -287px;
}




.story{
    margin: 0 auto;
    min-width: 980px;
    overflow: auto;
    width: 980px;

}

.story .float-left, .story .float-right{
    padding: 100px 0 0 0;
    position: relative;
    width: 350px;   
}


.linkp1 a {
    background:url('images/brandort_norm.gif') 0 0 no-repeat fixed;
    /*height: 12px;
    width: 95px;*/
    display: block;
    z-index:11111;
}

.linkp1 a:hover {
    background:url('images/brandort_hover.gif') 0 0 no-repeat fixed;
}


.linkp2 a {
    background:url('images/brandstifter_norm.gif') no-repeat fixed;
    /*height: 12px;
    width: 95px;*/
    display: block;
    z-index:11111;
}

.linkp2 a:hover {
    background:url('images/brandstifter_hover.gif') no-repeat fixed;
}

.linkp3 a {
    background:url('images/brandsaetze_norm.gif') no-repeat fixed;
    /*height: 12px;
    width: 95px;*/
    display: block;
    z-index:11111;
}

.linkp3 a:hover {
    background:url('images/brandsaetze_hover.gif') no-repeat fixed;
}

.linkp4 a {
    background:url('images/brandschaetze_norm.gif') no-repeat fixed;
    /*height: 12px;
    width: 95px;*/
    display: block;
    z-index:11111;
}

.linkp4 a:hover {
    background:url('images/brandschaetze_hover.gif') no-repeat fixed;
}

.linkp5 a {
    background:url('images/brandpunkt_norm.gif') no-repeat fixed;
    /*height: 12px;
    width: 95px;*/
    display: block;
    z-index:11111;
}

.linkp5 a:hover {
    background:url('images/brandpunkt_hover.gif') no-repeat fixed;
}




#menu_neu {
height: 40px;
width: 1200px;
text-align: center;
line-height:1em!important;
position: fixed;
left: 40%;
width: 640px;
z-index: 10000;
}

ul#topNav{
    margin-top:51px;
    margin-left: -218px;
    color:#000000;
}

ul#topNav li {
    list-style: none;
    display: inline;
    margin: 0; padding: 0;
    margin-top: 50%;
}

ul#topNav a, ul#topNav span {
    float: left;
    margin-right: 0.4em;
    margin-left: 0.1em;
    padding: 0.2em 1em;
    text-decoration: none;
    color:#000000;
    font-size:14px;
}

* html ul#topNav a, * html ul#topNav span {  /* Korrektur fuer IE 5.x */
    width: 8em;
    wi\dth: 6em;
}

ul#topNav a:hover, ul#topNav span {
    color:#000000;
    font-size:14px;
}

ul#topNav a:active {
    color:#000000;
    font-size:14px;
}

ul#topNav div {
     clear: left;
}

#topNav .current a {
    color:#F45D32;
}

演示:http://ealtinel.com/height/

如何让它在 IE 中运行?

最佳答案

在 IE 中,为了使元素具有 height:100%;,所有父元素都必须具有 height:100%;。 “链”中的任何中断都会导致 IE 忽略所有内容。

如果您的 css 包含以下内容,它应该可以工作:

html,body { height:100%; } 
#wrapper { height:100%; }
.section { height:100%; }

我已经在 IE 中打开了您的页面并使用开发人员工具应用了这些更改,并且可以验证它是否有效。

关于html - 高度 :100% not working in Internet Explorer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16811716/

有关html - 高度 :100% not working in Internet Explorer的更多相关文章

  1. ruby - 使用 ruby​​ 将 HTML 转换为纯文本并维护结构/格式 - 2

    我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h

  2. ruby-on-rails - Rails HTML 请求渲染 JSON - 2

    在我的Controller中,我通过以下方式在我的index方法中支持HTML和JSON:respond_todo|format|format.htmlformat.json{renderjson:@user}end在浏览器中拉起它时,它会自然地以HTML呈现。但是,当我对/user资源进行内容类型为application/json的curl调用时(因为它是索引方法),我仍然将HTML作为响应。如何获取JSON作为响应?我还需要说明什么? 最佳答案 您应该将.json附加到请求的url,提供的格式在routes.rb的路径中定义。这

  3. ruby-on-rails - 使用 Sublime Text 3 突出显示 HTML 背景语法中的 ERB? - 2

    所以我在关注Railscast,我注意到在html.erb文件中,ruby代码有一个微弱的背景高亮效果,以区别于其他代码HTML文档。我知道Ryan使用TextMate。我正在使用SublimeText3。我怎样才能达到同样的效果?谢谢! 最佳答案 为SublimeText安装ERB包。假设您安装了SublimeText包管理器*,只需点击cmd+shift+P即可获得命令菜单,然后键入installpackage并选择PackageControl:InstallPackage获取包管理器菜单。在该菜单中,键入ERB并在看到包时选择

  4. ruby-on-rails - Ruby url 到 html 链接转换 - 2

    我正在使用Rails构建一个简单的聊天应用程序。当用户输入url时,我希望将其输出为html链接(即“url”)。我想知道在Ruby中是否有任何库或众所周知的方法可以做到这一点。如果没有,我有一些不错的正则表达式示例代码可以使用... 最佳答案 查看auto_linkRails提供的辅助方法。这会将所有URL和电子邮件地址变成可点击的链接(htmlanchor标记)。这是文档中的代码示例。auto_link("Gotohttp://www.rubyonrails.organdsayhellotodavid@loudthinking.

  5. ruby-on-rails - capybara ::ElementNotFound:无法找到 xpath "/html" - 2

    我正在学习http://ruby.railstutorial.org/chapters/static-pages上的RubyonRails教程并遇到以下错误StaticPagesHomepageshouldhavethecontent'SampleApp'Failure/Error:page.shouldhave_content('SampleApp')Capybara::ElementNotFound:Unabletofindxpath"/html"#(eval):2:in`text'#./spec/requests/static_pages_spec.rb:7:in`(root)'

  6. ruby - 如何使用 Ruby 将 CSV 文件读入 HTML 表格? - 2

    我正在尝试将一个简单的CSV文件读入HTML表格以在浏览器中显示,但我遇到了麻烦。这就是我正在尝试的:Controller:defshow@csv=CSV.open("file.csv",:headers=>true)end查看:输出:NameStartDateEndDateQuantityPostalCode基本上我只获取标题,而不会读取和呈现CSV正文。 最佳答案 这最终成为最终解决方案:Controller:defshow#OpenaCSVfile,andthenreaditintoaCSV::Tableobjectforda

  7. ruby - 如何使用 Nokogiri 解析纯 HTML 表格? - 2

    我想用Nokogiri解析HTML页面。页面的一部分有一个表,它没有使用任何特定的ID。是否可以提取如下内容:Today,3,455,34Today,1,1300,3664Today,10,100000,3444,Yesterday,3454,5656,3Yesterday,3545,1000,10Yesterday,3411,36223,15来自这个HTML:TodayYesterdayQntySizeLengthLengthSizeQnty345534345456563113003664354510001010100000344434113622315

  8. ruby-on-rails - 连接字符串时如何在 <%=%> block 内输出 html_safe? - 2

    考虑一下:现在这些情况:#output:http://domain.com/?foo=1&bar=2#output:http://domain.com/?foo=1&bar=2#output:http://domain.com/?foo=1&bar=2#output:http://domain.com/?foo=1&bar=2我需要用其他字符串输出URL。我如何保证&符号不会被转义?由于我无法控制的原因,我无法发送&。求助!把我的头发拉到这里:\编辑:为了澄清,我实际上有一个像这样的数组:@images=[{:id=>"fooid",:url=>"http://

  9. ruby-on-rails - 我需要从 HTML 转到 markdown,有什么建议吗? - 2

    我正在使用Maruku,将Markdown(超集)转换为HTML,你知道我该怎么做才能从HTML转换为Markdown吗? 最佳答案 Google发现了一个名为reverse_markdown的ruby​​脚本.它似乎可以满足您的需求。 关于ruby-on-rails-我需要从HTML转到markdown,有什么建议吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/175162

  10. ruby - 使用 Nokogiri 和 Ruby 从 html 文档获取链接和 href 文本? - 2

    我正在尝试使用nokogirigem提取页面上的所有url及其链接文本,并将链接文本和url存储在散列中。FooBar我想回去{"Foo"=>"#foo","Bar"=>"#bar"} 最佳答案 这是一个单行:Hash[doc.xpath('//a[@href]').map{|link|[link.text.strip,link["href"]]}]#=>{"Foo"=>"#foo","Bar"=>"#bar"}拆分一点可以说更具可读性:h={}doc.xpath('//a[@href]').eachdo|link|h[link.t

随机推荐