基本上我想要做的是在我的页面顶部有一个单一的、细长的工具栏,其中有一排用作按钮的各种 DIV 容器。我希望这些按钮更新工具栏下方 iframe 的内容。问题是我的工具栏下方的 iframe 高度只有 150 像素。具体来说,当我指定时会发生这种情况<!DOCTYPE html>,但是当我不指定此 HTML5 文档类型时,它可以正常工作。
我读了一点,看起来原因是 HTML5 不再涵盖能够设置 iFrame 宽度和高度的百分比。 但是现在我被卡住了,因为我无法让 iFrame 增长到工具栏下窗口剩余高度的 100%。我什至创建了一个 iframe_container DIV 并将 iframe 放入其中, iframe_container 位于 height=%100 但我仍然无法使其正常工作。
HTML:
<!DOCTYPE html>
<html>
<body>
<div class="header_bar">
<div class="tab_active" onclick="location.href='...'">Tab1</div>
<div class="tab_inactive" onclick="location.href='...'">Tab2</div>
<div class="tab_inactive" onclick="location.href='...'">Tab3</div>
</div>
<div class="iframe_container">
<iframe id="main_iframe" class="main_iframe" frameborder="0" src="...">
</iframe>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
CSS:
.iframe_container {
width: 100%;
height: 100%;
}
.main_iframe {
width: 100%;
height: 100%;
}
.header_bar {
float: none; …Run Code Online (Sandbox Code Playgroud) 我在虚拟主机中为子域设置了两个简单的重定向;一个正在工作,一个没有工作:
<VirtualHost *:80>
ServerName subdomain.site.com
Redirect / https://subdomain.site.com/subdirectory/login.php
</VirtualHost>
<VirtualHost x.x.x.x:443>
ServerName subdomain.site.com
Redirect / https://subdomain.site.com/subdirectory/login.php
SSLEngine on
SSLCertificateFile /etc/httpd/ssl/subdomain.site.com.crt
SSLCertificateKeyFile /etc/httpd/ssl/subdomain.site.com.key
ErrorLog logs/ssl_error_log
CustomLog logs/ssl_access_log common
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
第一次重定向正在工作。也就是说,如果有人只是在浏览器中键入subdomain.site.com,它就会重定向到https和正确的子目录。第二个重定向不起作用。如果有人键入https://subdomain.site.com,则显示“ Firefox已检测到服务器正在以永远无法完成的方式重定向对该地址的请求”,并且浏览器URL变为“ subdomain.site.com/subdirectory” /login.phpsubdirectory/login.phpsubdirectory/login.phpsubdirectory/login.php ...”,而不是重定向到正确的https://subdomain.site.com/subdirectory/login.php页面。谁能指出我正确的方向?
编辑:我将上述VirtualHosts文件更新为较新的版本,并且该问题已更改,因此我也更新了问题描述。