dongzhunnai0140 2016-08-15 06:43
浏览 126
已采纳

位置:固定 - 将我的页脚推到标题上

please bear with my terrible coding (I am still learning) I am creating a wordpress webpage for my boss that is simply a header.php index.php and footer.php

The content in index.php is just an iframe which I want to sit behind the header.php and the footer.php. Although when I apply a position:fixed; to my iframe (so that it fills the webpage) my footer jumps up and covers my header.php.

I am struggling to find a way I can have a 100% sized iframe (no scroll) as well as a footer menu that stays down the bottom of my page

thanks in advance :)

body, html {
    margin: 0;
    padding: 0;
}

#container {
    display: inline-block;
}


header {
    top: 0;
    z-index: 1;
    position: absolute;
    background: rgba(255, 255, 255, 0.5);
    overflow: hidden;
    width: 100%;
    height: 100px;

 
}
.bmenu li{
    display: inline-block;
}


#menu1 ul{
    float: left;
}

#menu2 {
    float: right;
    padding-right: 5%;
}

#logo img{
    margin-left: 15%;
    width:  300px;
    max-width: 100%;
}

.cmenu li{
    display: inline;
    padding: 20px 50px;
    max-width: 100%;
}

#navigation3 ul{
    margin-left:40%;
    margin-bottom: 10px;
    max-width: 100%;
    z-index: 1;
    position: fixed;
}

iframe {
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  position: fixed;
    }
<body>

  <div id="container">
    <header>

      <div id="menu1">
        <nav id="navigation1">
          <ul>
            <li>menu item</li>
            <li>menu item</li>
            <li>menu itemm</li>
          </ul>
        </nav>
      </div>

      <div id="menu2">
        <nav id="navigation2">
          <ul>
            <li>menu item</li>
            <li>menu item</li>
            <li>menu itemm</li>
          </ul>
        </nav>
      </div>


      <div id="logo">
        <img src="<?php bloginfo('stylesheet_directory'); ?>/images/logo.png" alt="logo">
      </div>
    </header>

    <article>
      <iframe name="background" scrolling="no" src="https://www.bing.com.au" frameborder="0">
        <p>Your browser does not support iframes.</p>
      </iframe>
    </article>

    <div id="footer">
      <nav id="navigation3">
        <ul>
          <li>menu item</li>
          <li>menu item</li>
          <li>menu itemm</li>
        </ul>
      </nav>
    </div>

    <?php wp_footer(); ?>
  </div>
</body>

</div>
  • 写回答

1条回答 默认 最新

  • du13932014807 2016-08-15 06:59
    关注

    Try it :

    
        #footer {
            position: absolute;
            bottom: 0;
            left: 0;
        }
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败
  • ¥15 MapReduce实现倒排索引失败
  • ¥15 ZABBIX6.0L连接数据库报错,如何解决?(操作系统-centos)
  • ¥15 找一位技术过硬的游戏pj程序员
  • ¥15 matlab生成电测深三层曲线模型代码