将滚动内容定位在固定的flexbox导航菜单下


15

我有以下代码段(需要以全屏模式查看),我试图将<main>元素直接放置在元素下方<header>。我将<header>其固定在一个位置,因为当用户滚动浏览内容时,我希望它停留在屏幕顶部<main>元素中。我已经尝试了所有我知道的东西,但是我能想到的最好的办法是将该<header>元素放在该元素的顶部<main>,这样可以减少大部分内容。

我想出的最接近的解决方案是在<main>元素上加上一个推测的顶部填充,以便清除<header>。但是,此解决方案无法很好地说明各种屏幕尺寸,因为我使用的是rem sizing而不是px。当将多个元素放置在<header>使用相对或基于百分比的高度的元素内时,顶部填充的想法变得更糟。在一个屏幕尺寸上,所有内容都可以完美地排列在一起;在另一个屏幕尺寸上,内容可能相去甚远。

最后,我知道我可以使用jQuery动态设置顶部填充,但是它似乎并不总是能很好地工作。想知道是否有一个纯CSS / HTML解决方案。

谁能告诉我我在这里想念的东西吗?我的最佳填充方法是唯一可行的解​​决方案吗?

$(document).ready(function() {
  $('#navToggle').click(function() {
    $("div#bottom-container > nav").slideToggle();
  });

  $(window).resize(function() {
      if(window.innerWidth >= "751") {
          $("header > div#bottom-container > nav").show();
      }else {
          $("header > div#bottom-container > nav").hide();
      }
  });

  $("header > div#bottom-container > nav > ul > li > a").click(function(e) {
     if (window.innerWidth <= "750") {
       if ($(this).siblings().size() > 0) {
         e.preventDefault();
         $(this).siblings().slideToggle("slow");
      }
    }
  });

   $("header > div#bottom-container > nav > ul > li").hover(function() {
        if (window.innerWidth >= "751") {
          if ($(this).children("nav").size() > 0) {
            $(this).children("nav").stop().show();
         }
       }
     },function(){
       if (window.innerWidth >= "751") {
         if ($(this).children("nav").size() > 0) {
           $(this).children("nav").hide();
        }
      }
  });
});
* {
  margin: 0;
}

@media (min-width: 48rem) {
  :root {
    font-size: calc(1rem + ((1vw - .48rem) * 1.389));
  }
}

body {
  background: #eee;
  font-family: "HelveticaNeue-Light", Arial;
  height: auto !important;
}

#head-wrap{
    margin: 0 auto;
    position: relative;
    width:100%;
}
#second-wrap{
    position: fixed;
    width:100%;
    z-index:999;
}
main{
  height:4000px;
  position:relative;
  padding-top:13rem;
}

header{
  position: absolute;
  top:0;
  left:0;
  width:100%;
  overflow-x: hidden;
  overflow-y: auto;
  height:200rem;
}

#navToggle {
  background-color: rgba(0, 0, 0, .15);
  position: relative;
  right: 0;
  top: 0;
  z-index:999;
  height: 2.6rem;
}

#navToggle>a {
  color: rgba(255, 255, 255, .85);
  display: block;
  font-size: 0.85em;
  font-weight: 600;
  padding: 0 2.5rem;
  text-decoration: none;
  transition: all 300ms ease;
  padding-top:.9rem;
}

#bottom-container {
  display: flex;
  flex-direction: column;
  text-align: center;
  box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
}

#bottom-container>nav {
  background-color: rgb(250, 209, 14);
  display: none;
  flex: 1;
}

#bottom-container nav>ul {
  list-style-type: none;
}

#bottom-container nav>ul>li {
  position: relative;
}

#bottom-container nav>ul>li>a {
  display: block;
  color: rgba(0, 0, 0, .65);
  padding: 1.3rem 0;
  text-decoration: none;
}

#bottom-container nav>ul>li>a span.toggle {
  background-color: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .25);
  padding: 2px 8px;
}

#bottom-container>nav>ul>li>nav {
  display: none;
  overflow: hidden;
  position: absolute;
  top:100%;
  right: 5%;
  width: 90%;
  z-index: 100;
  background-color: rgb(250, 250, 250);
  margin-bottom:10rem;
}

header>nav>ul>li>nav>ul>li>a {
  color: rgba(255, 255, 255, .85);
}

/*
/////////////////////////////////////////////////
/////////////////////////////////////////////////
////   THIS IS THE ONLY FIX I KNOW OF  //////////
*/
main{
  padding-top:5rem;
}
/*
////////////////////////////////////////////////
////////////////////////////////////////////////
*/

/* Medium screens */
@media all and (min-width: 751px) {
  header{
    overflow-y:visible;
    overflow-x:visible;
    padding-bottom:0;
  }

  #navToggle {
    display: none;
  }

  #bottom-container {
    background-color: rgb(250, 209, 14);
    width: 100%;
    border-top: calc(5vh + 2vw) solid yellow;
  }

  #bottom-container>nav {
    display: block;
  }

  #bottom-container>nav>ul {
    display: flex;
    justify-content: center;
    flex-direction: row;
    height: 3rem;
  }

  #bottom-container nav>ul>li {
    position: static;
    flex:1;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #bottom-container nav>ul>li>a {
   padding: 0;
  }

  #bottom-container nav>ul>li>a span.toggle {
    display: none;
  }

  #bottom-container >nav>ul>li>nav>ul>li{
    line-height: 2.5rem;
  }
  #bottom-container>nav>ul>li>nav {
    margin-top:-194.5rem;
  }
}
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<div id="head-wrap">
  <div id="second-wrap">
    <header>
      <div id="navToggle"><a href="#">Menu</a></div>
      <div id='bottom-container'>
        <nav>
          <ul>
            <li><a href="#">ITEM ONE</a></li>
            <li class="sub1">
              <a href="#">ITEM TWO <span class="toggle">Expand</span></a>
            <nav>
              <ul>
                <li><a href="#">Sub Item 1</a></li>
                <li><a href="#">Sub Item 2</a></li>
                <li><a href="#">Sub Item 3</a></li>
                <li><a href="#">Sub Item 4</a></li>
              </ul>
            </nav>
            <li><a href="#">ITEM THREE</a></li>
          </ul>
        </nav>
      </div>
    </header>
  </div>
</div>

<main>
  <p>content top not visible but should be able to see</P>
  <p>line 1</P>
  <p>line 2</P>
  <p>line 3</P>
  <p>line 4</P>
  <p>line 5</P>
  <p>line 6</P>
  <p>line 7</P>
  <p>line 8</P>
  <p>line 9</P>
  <p>line 10</P>
    <p>line 11</P>
    <p>line 12</P>
    <p>line 13</P>
    <p>line 14</P>
    <p>line 15</P>
    <p>line 16</P>
    <p>line 17</P>
    <p>line 18</P>
    <p>line 19</P>
    <p>line 20</P>
</main>
</body>
</html>


在全屏模式下,主屏幕已经位于标题下方,但在移动设备中则不
可见

那是因为放置在main元素上的padding-top 。笨拙,但是有点用。想知道是否有更好的解决方案。
奥斯汀

我不是你想知道什么后禁止黄色边框,这是PIC ibb.co/bR0YykQ可你把屏幕拍
艾曼Morsy

我的示例是实时版本的简化版本。在我的实时版本中,我的<header>元素中有几个flex元素,它们全部使用百分比或相对高度。这使得在<main>元素上添加固定的顶垫几乎没有用。该<main>元素在一种屏幕尺寸上可能排列良好,而在另一种屏幕尺寸上却排列不佳。看起来jQuery可能是我唯一的解决方案,在<main>元素上使用css顶部垫进行备份。
奥斯汀

您是否尝试过使用CSS position: sticky developer.mozilla.org/en-US/docs/Web/CSS/position而不是使用JS?
亚瑟

Answers:


1

我已经取得了相同的结果(如果我错了,请纠正我),但是没有js。看起来,下面的内容考虑了任何标题高度。

主要思想 -不包装<header>并应用于它position: stickyz-index也没有必要。

我没有完全使用您的代码,而是试图重复结果。希望您能找到一些有用的想法解决您的问题。

当屏幕宽度较小并切换菜单时,一些答案代码会将其下推。我的代码不包含该问题。

* {
    margin: 0;
}
  
@media (min-width: 48rem) {
    :root {
        font-size: calc(1rem + ((1vw - .48rem) * 1.389));
    }
}
  
body {
    background: #eee;
    font-family: "HelveticaNeue-Light", Arial;
    height: auto !important;
 }

header {
    width: 100%;
    position: sticky;
    top: 0;
    box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
}

.wrapper {
    position: relative;
    background-color: rgba(0, 0, 0, .15);
}

#navToggle {
    display: inline-block;
    height: 2.6rem;
}

#navToggle > a {
    color: rgba(255, 255, 255, .85);
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    padding: 0 2.5rem;
    text-decoration: none;
    transition: all 300ms ease;
    padding-top: .9rem;
}

#navToggle:hover + #bottom-container, #bottom-container:hover  {
    visibility: visible;
    opacity: 1;
    transition: all 0.2s ease-in-out;
}

#bottom-container {
    background-color: rgb(250, 209, 14);
    width: 100%;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 0;
}

#bottom-container > nav  ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

#bottom-container > nav > ul {
    display: flex;
    flex-direction: column;
    flex: 1;
    align-items: center;
}

#bottom-container > nav > ul li {
    display: flex;
    justify-content: center;
    width: 100%;

}

#bottom-container nav > ul > li > a {
    display: block;
    color: rgba(0, 0, 0, .65);
    padding: 1.3rem 0;
    text-decoration: none;
}

.sub1 {
    position: relative;
}

.sub1 > nav {
    position: absolute;
    top: 100%;
    left: 0;
    visibility: hidden;
    opacity: 0;
    background-color: rgb(250, 250, 250);
    width: 100%;
    transition: all 0.2s ease-in-out;
}

.sub1 > nav ul li {
    text-align: center;
}

.sub1 > a:hover + nav, .sub1 > a + nav:hover {
    visibility: visible;
    opacity: 1;
    transition: all 0.2s ease-in-out;
}

#bottom-container nav>ul>li>a span.toggle {
    background-color: rgba(0, 0, 0, .05);
    color: rgba(0, 0, 0, .25);
    padding: 2px 8px;
}

main {
    height:4000px;
}

@media (min-width: 751px){
    #bottom-container > nav > ul {
        flex-direction: row;
        height: 3rem;
    }
    
    #bottom-container nav>ul>li>a span.toggle {
        display: none;
    }
    
    #bottom-container {
        height: 100%;
        border-top: calc(5vh + 2vw) solid yellow;
        visibility: visible;
        opacity: 1;
        position: static;
    }

    #navToggle {
        display: none;
    }
}
<!doctype html>

<html lang="en">

<head>
    <meta charset="utf-8">

    <title></title>

    <link rel="stylesheet" href="styles.css">

</head>

<body>
    <header>
        <div class="wrapper">
            <div id="navToggle"><a href="#">Menu</a></div>
            <div id='bottom-container'>
                <nav>
                    <ul>
                        <li><a href="#">ITEM ONE</a></li>
                        <li class="sub1">
                            <a href="#">ITEM TWO <span class="toggle">Expand</span></a>
                            <nav>
                                <ul>
                                    <li><a href="#">Sub Item 1</a></li>
                                    <li><a href="#">Sub Item 2</a></li>
                                    <li><a href="#">Sub Item 3</a></li>
                                    <li><a href="#">Sub Item 4</a></li>
                                </ul>
                            </nav>
                        <li><a href="#">ITEM THREE</a></li>
                    </ul>
                </nav>
            </div>
        </div>
        
    </header>


    <main>
        <p>content top not visible but should be able to see</P>
        <p>line 1</P>
        <p>line 2</P>
        <p>line 3</P>
        <p>line 4</P>
        <p>line 5</P>
        <p>line 6</P>
        <p>line 7</P>
        <p>line 8</P>
        <p>line 9</P>
        <p>line 10</P>
        <p>line 11</P>
        <p>line 12</P>
        <p>line 13</P>
        <p>line 14</P>
        <p>line 15</P>
        <p>line 16</P>
        <p>line 17</P>
        <p>line 18</P>
        <p>line 19</P>
        <p>line 20</P>
    </main>
</body>

</html>


在小屏幕上,当标题为灰色时,主要内容滚动到标题的前面。
somethingEveryJan

@thing每一个都是由于background-color中的alpha通道:rgba(0,0,0,.15); 我把颜色从作者的代码
亚历山大Belugin

4

请删除标题元素的前两个div容器,因为不需要包装标题。标头元素已经是容器。

请删除height:200rem;标题样式和padding-top: 13rem or 5rem主要元素的样式。

最后,请将标头样式的position属性更新为粘滞,而不是absolute添加z-index。

下面,我已经对其进行了测试并更新了代码库。

$(document).ready(function() {
  $('#navToggle').click(function() {
    $("div#bottom-container > nav").slideToggle();
  });

  $(window).resize(function() {
      if(window.innerWidth >= "751") {
          $("header > div#bottom-container > nav").show();
      }else {
          $("header > div#bottom-container > nav").hide();
      }
  });

  $("header > div#bottom-container > nav > ul > li > a").click(function(e) {
     if (window.innerWidth <= "750") {
       if ($(this).siblings().size() > 0) {
         e.preventDefault();
         $(this).siblings().slideToggle("slow");
      }
    }
  });

   $("header > div#bottom-container > nav > ul > li").hover(function() {
        if (window.innerWidth >= "751") {
          if ($(this).children("nav").size() > 0) {
            $(this).children("nav").stop().show();
         }
       }
     },function(){
       if (window.innerWidth >= "751") {
         if ($(this).children("nav").size() > 0) {
           $(this).children("nav").hide();
        }
      }
  });
});
* {
  margin: 0;
}

@media (min-width: 48rem) {
  :root {
    font-size: calc(1rem + ((1vw - .48rem) * 1.389));
  }
}

body {
  background: #eee;
  font-family: "HelveticaNeue-Light", Arial;
  height: auto !important;
}

main{
  height:4000px;
  position:relative;
}

header{
  position: sticky;
  z-index: 100;
  top:0;
  left:0;
  width:100%;
}

#navToggle {
  background-color: rgba(0, 0, 0, .15);
  position: relative;
  right: 0;
  top: 0;
  z-index:999;
  height: 2.6rem;
}

#navToggle>a {
  color: rgba(255, 255, 255, .85);
  display: block;
  font-size: 0.85em;
  font-weight: 600;
  padding: 0 2.5rem;
  text-decoration: none;
  transition: all 300ms ease;
  padding-top:.9rem;
}

#bottom-container {
  display: flex;
  flex-direction: column;
  text-align: center;
  box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
}

#bottom-container>nav {
  background-color: rgb(250, 209, 14);
  display: none;
  flex: 1;
}

#bottom-container nav>ul {
  list-style-type: none;
}

#bottom-container nav>ul>li {
  position: relative;
}

#bottom-container nav>ul>li>a {
  display: block;
  color: rgba(0, 0, 0, .65);
  padding: 1.3rem 0;
  text-decoration: none;
}

#bottom-container nav>ul>li>a span.toggle {
  background-color: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .25);
  padding: 2px 8px;
}

#bottom-container>nav>ul>li>nav {
  display: none;
  overflow: hidden;
  position: absolute;
  top:100%;
  right: 5%;
  width: 90%;
  z-index: 100;
  background-color: rgb(250, 250, 250);
  margin-bottom:10rem;
}

header>nav>ul>li>nav>ul>li>a {
  color: rgba(255, 255, 255, .85);
}

/*
/////////////////////////////////////////////////
/////////////////////////////////////////////////
////   THIS IS THE ONLY FIX I KNOW OF  //////////
*/
main{
  /* remove padding top */
}
/*
////////////////////////////////////////////////
////////////////////////////////////////////////
*/

/* Medium screens */
@media all and (min-width: 751px) {
  header{
    overflow-y:visible;
    overflow-x:visible;
    padding-bottom:0;
  }

  #navToggle {
    display: none;
  }

  #bottom-container {
    background-color: rgb(250, 209, 14);
    width: 100%;
    border-top: calc(5vh + 2vw) solid yellow;
  }

  #bottom-container>nav {
    display: block;
  }

  #bottom-container>nav>ul {
    display: flex;
    justify-content: center;
    flex-direction: row;
    height: 3rem;
  }

  #bottom-container nav>ul>li {
    position: static;
    flex:1;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #bottom-container nav>ul>li>a {
   padding: 0;
  }

  #bottom-container nav>ul>li>a span.toggle {
    display: none;
  }

  #bottom-container >nav>ul>li>nav>ul>li{
    line-height: 2.5rem;
  }
  #bottom-container>nav>ul>li>nav {
    margin-top:-194.5rem;
  }
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>

  <header>
    <div id="navToggle"><a href="#">Menu</a></div>
    <div id='bottom-container'>
      <nav>
        <ul>
          <li><a href="#">ITEM ONE</a></li>
          <li class="sub1">
            <a href="#">ITEM TWO <span class="toggle">Expand</span></a>
          <nav>
            <ul>
              <li><a href="#">Sub Item 1</a></li>
              <li><a href="#">Sub Item 2</a></li>
              <li><a href="#">Sub Item 3</a></li>
              <li><a href="#">Sub Item 4</a></li>
            </ul>
          </nav>
          <li><a href="#">ITEM THREE</a></li>
        </ul>
      </nav>
    </div>
  </header>

  <main>
    <p>content top not visible but should be able to see</P>
    <p>line 1</P>
    <p>line 2</P>
    <p>line 3</P>
    <p>line 4</P>
    <p>line 5</P>
    <p>line 6</P>
    <p>line 7</P>
    <p>line 8</P>
    <p>line 9</P>
    <p>line 10</P>
      <p>line 11</P>
      <p>line 12</P>
      <p>line 13</P>
      <p>line 14</P>
      <p>line 15</P>
      <p>line 16</P>
      <p>line 17</P>
      <p>line 18</P>
      <p>line 19</P>
      <p>line 20</P>
  </main>
</body>
</html>
 Run code snippet


在小屏幕上,当标题为灰色时,主要内容滚动到标题的前面。
somethingEveryJan

因为在标题的navToggle元素中设置了背景不透明度。要解决此问题,您可以删除不透明度。
上升

4

这有点粗糙,但是您可以创建第二个标头,该标头隐藏在真实的标头后面,该标头保留在文档流中并向下推<main>

只需复制构成标头的元素,将其降低,z-index然后将其从切换为position: fixed即可position: relative。然后,只需除去隐藏<header>元素的高度并padding-top从中删除即可<main>

$(document).ready(function() {
  $('#navToggle').click(function() {
    $("div#bottom-container > nav").slideToggle();
  });

  $(window).resize(function() {
      if(window.innerWidth >= "751") {
          $("header > div#bottom-container > nav").show();
      }else {
          $("header > div#bottom-container > nav").hide();
      }
  });

  $("header > div#bottom-container > nav > ul > li > a").click(function(e) {
     if (window.innerWidth <= "750") {
       if ($(this).siblings().size() > 0) {
         e.preventDefault();
         $(this).siblings().slideToggle("slow");
      }
    }
  });

   $("header > div#bottom-container > nav > ul > li").hover(function() {
        if (window.innerWidth >= "751") {
          if ($(this).children("nav").size() > 0) {
            $(this).children("nav").stop().show();
         }
       }
     },function(){
       if (window.innerWidth >= "751") {
         if ($(this).children("nav").size() > 0) {
           $(this).children("nav").hide();
        }
      }
  });
});
* {
  margin: 0;
}

@media (min-width: 48rem) {
  :root {
    font-size: calc(1rem + ((1vw - .48rem) * 1.389));
  }
}

body {
  background: #eee;
  font-family: "HelveticaNeue-Light", Arial;
  height: auto !important;
}

#head-wrap,
#hidden-wrap{
    margin: 0 auto;
    position: relative;
    width:100%;
}
#hidden-wrap header {
  height: inherit;
  position: relative;
}
#second-wrap{
    position: fixed;
    width:100%;
    z-index:999;
}
#second-wrap2{
    position: relative;
    width:100%;
    z-index:998;
}

main{
  height:4000px;
  position:relative;
  /* padding-top:13rem; */
}

header{
  position: absolute;
  top:0;
  left:0;
  width:100%;
  overflow-x: hidden;
  overflow-y: auto;
  height:200rem;
}

#navToggle,
#navToggle2{
  background-color: rgba(0, 0, 0, .15);
  position: relative;
  right: 0;
  top: 0;
  z-index:999;
  height: 2.6rem;
}

#navToggle>a,
#navToggle2>a{
  color: rgba(255, 255, 255, .85);
  display: block;
  font-size: 0.85em;
  font-weight: 600;
  padding: 0 2.5rem;
  text-decoration: none;
  transition: all 300ms ease;
  padding-top:.9rem;
}

#bottom-container,
#bottom-container2{
  display: flex;
  flex-direction: column;
  text-align: center;
  box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
}

#bottom-container>nav,
#bottom-container2>nav{
  background-color: rgb(250, 209, 14);
  display: none;
  flex: 1;
}

#bottom-container nav>ul,
#bottom-container2 nav>ul{
  list-style-type: none;
}

#bottom-container nav>ul>li,
#bottom-container2 nav>ul>li{
  position: relative;
}

#bottom-container nav>ul>li>a,
#bottom-container2 nav>ul>li>a{
  display: block;
  color: rgba(0, 0, 0, .65);
  padding: 1.3rem 0;
  text-decoration: none;
}

#bottom-container nav>ul>li>a span.toggle,
#bottom-container2 nav>ul>li>a span.toggle{
  background-color: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .25);
  padding: 2px 8px;
}

#bottom-container>nav>ul>li>nav,
#bottom-container2>nav>ul>li>nav{
  display: none;
  overflow: hidden;
  position: absolute;
  top:100%;
  right: 5%;
  width: 90%;
  z-index: 100;
  background-color: rgb(250, 250, 250);
  margin-bottom:10rem;
}

header>nav>ul>li>nav>ul>li>a {
  color: rgba(255, 255, 255, .85);
}

/*
/////////////////////////////////////////////////
/////////////////////////////////////////////////
////   THIS IS THE ONLY FIX I KNOW OF  //////////
*/
main{
  /*padding-top:5rem;*/
}
/*
////////////////////////////////////////////////
////////////////////////////////////////////////
*/

/* Medium screens */
@media all and (min-width: 751px) {
  header{
    overflow-y:visible;
    overflow-x:visible;
    padding-bottom:0;
  }

  #navToggle,
  #navToggle2{
    display: none;
  }

  #bottom-container,
  #bottom-container2{
    background-color: rgb(250, 209, 14);
    width: 100%;
    border-top: calc(5vh + 2vw) solid yellow;
  }

  #bottom-container>nav,
  #bottom-container2>nav{
    display: block;
  }

  #bottom-container>nav>ul,
  #bottom-container2>nav>ul{
    display: flex;
    justify-content: center;
    flex-direction: row;
    height: 3rem;
  }

  #bottom-container nav>ul>li,
  #bottom-container2 nav>ul>li{
    position: static;
    flex:1;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #bottom-container nav>ul>li>a,
  #bottom-container2 nav>ul>li>a{
   padding: 0;
  }

  #bottom-container nav>ul>li>a span.toggle,
  #bottom-container2 nav>ul>li>a span.toggle{
    display: none;
  }

  #bottom-container >nav>ul>li>nav>ul>li,
  #bottom-container2 >nav>ul>li>nav>ul>li{
    line-height: 2.5rem;
  }
  #bottom-container>nav>ul>li>nav,
  #bottom-container2>nav>ul>li>nav{
    margin-top:-194.5rem;
  }
}
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<div id="head-wrap">
  <div id="second-wrap">
    <header>
      <div id="navToggle"><a href="#">Menu</a></div>
      <div id='bottom-container'>
        <nav>
          <ul>
            <li><a href="#">ITEM ONE</a></li>
            <li class="sub1">
              <a href="#">ITEM TWO <span class="toggle">Expand</span></a>
            <nav>
              <ul>
                <li><a href="#">Sub Item 1</a></li>
                <li><a href="#">Sub Item 2</a></li>
                <li><a href="#">Sub Item 3</a></li>
                <li><a href="#">Sub Item 4</a></li>
              </ul>
            </nav>
            <li><a href="#">ITEM THREE</a></li>
          </ul>
        </nav>
      </div>
    </header>
  </div>
</div>
<div id="hidden-wrap">
  <div id="second-wrap2">
    <header>
      <div id="navToggle2"><a href="#">Menu</a></div>
      <div id='bottom-container2'>
        <nav>
          <ul>
            <li><a href="#">ITEM ONE</a></li>
            <li class="sub1">
              <a href="#">ITEM TWO <span class="toggle">Expand</span></a>
            <nav>
              <ul>
                <li><a href="#">Sub Item 1</a></li>
                <li><a href="#">Sub Item 2</a></li>
                <li><a href="#">Sub Item 3</a></li>
                <li><a href="#">Sub Item 4</a></li>
              </ul>
            </nav>
            <li><a href="#">ITEM THREE</a></li>
            </li>
          </ul>
        </nav>
      </div>
    </header>
  </div>
</div>

<main>
  <p>now you can see this text</p>
  <p>line 1</p>
  <p>line 2</p>
  <p>line 3</p>
  <p>line 4</p>
  <p>line 5</p>
  <p>line 6</p>
  <p>line 7</p>
  <p>line 8</p>
  <p>line 9</p>
  <p>line 10</p>
    <p>line 11</p>
    <p>line 12</p>
    <p>line 13</p>
    <p>line 14</p>
    <p>line 15</p>
    <p>line 16</p>
    <p>line 17</p>
    <p>line 18</p>
    <p>line 19</p>
    <p>line 20</p>
</main>
</body>
</html>

编辑:我不知道为什么我以前没有想到这一点。只需设置#headwrap<main>即可position: relative。然后,移除heighton <main>并将其设置<body>display: flexflex-direction: column。最后,将中的内容包装<main><div>

在这里,我将div的高度设置为4000px,以演示滚动。

$(document).ready(function() {
  $('#navToggle').click(function() {
    $("div#bottom-container > nav").slideToggle();
  });

  $(window).resize(function() {
      if(window.innerWidth >= "751") {
          $("header > div#bottom-container > nav").show();
      }else {
          $("header > div#bottom-container > nav").hide();
      }
  });

  $("header > div#bottom-container > nav > ul > li > a").click(function(e) {
     if (window.innerWidth <= "750") {
       if ($(this).siblings().size() > 0) {
         e.preventDefault();
         $(this).siblings().slideToggle("slow");
      }
    }
  });

   $("header > div#bottom-container > nav > ul > li").hover(function() {
        if (window.innerWidth >= "751") {
          if ($(this).children("nav").size() > 0) {
            $(this).children("nav").stop().show();
         }
       }
     },function(){
       if (window.innerWidth >= "751") {
         if ($(this).children("nav").size() > 0) {
           $(this).children("nav").hide();
        }
      }
  });
});
* {
  margin: 0;
}

@media (min-width: 48rem) {
  :root {
    font-size: calc(1rem + ((1vw - .48rem) * 1.389));
  }
}

body {
  background: #eee;
  font-family: "HelveticaNeue-Light", Arial;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#head-wrap{
    margin: 0 auto;
    position: relative;
    width:100%;
}

#second-wrap{
    position: relative;
    width:100%;
    z-index:999;
}

main{
  /*height:4000px;*/
  position:relative;
  overflow: auto;
  /* padding-top:13rem; */
}

main>div {
  height: 4000px;
}

header{
  position: relative;
  top:0;
  left:0;
  width:100%;
  overflow-x: hidden;
  overflow-y: auto;
  /*height:200rem;*/
}

#navToggle{
  background-color: rgba(0, 0, 0, .15);
  position: relative;
  right: 0;
  top: 0;
  z-index:999;
  height: 2.6rem;
}

#navToggle>a{
  color: rgba(255, 255, 255, .85);
  display: block;
  font-size: 0.85em;
  font-weight: 600;
  padding: 0 2.5rem;
  text-decoration: none;
  transition: all 300ms ease;
  padding-top:.9rem;
}

#bottom-container{
  display: flex;
  flex-direction: column;
  text-align: center;
  box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
}

#bottom-container>nav{
  background-color: rgb(250, 209, 14);
  display: none;
  flex: 1;
}

#bottom-container nav>ul{
  list-style-type: none;
}

#bottom-container nav>ul>li{
  position: relative;
}

#bottom-container nav>ul>li>a{
  display: block;
  color: rgba(0, 0, 0, .65);
  padding: 1.3rem 0;
  text-decoration: none;
}

#bottom-container nav>ul>li>a span.toggle{
  background-color: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .25);
  padding: 2px 8px;
}

#bottom-container>nav>ul>li>nav{
  display: none;
  overflow: hidden;
  position: absolute;
  top:100%;
  right: 5%;
  width: 90%;
  z-index: 100;
  background-color: rgb(250, 250, 250);
  margin-bottom:10rem;
}

header>nav>ul>li>nav>ul>li>a {
  color: rgba(255, 255, 255, .85);
}

/*
/////////////////////////////////////////////////
/////////////////////////////////////////////////
////   THIS IS THE ONLY FIX I KNOW OF  //////////
*/
main{
  /*padding-top:5rem;*/
}
/*
////////////////////////////////////////////////
////////////////////////////////////////////////
*/

/* Medium screens */
@media all and (min-width: 751px) {
  header{
    overflow-y:visible;
    overflow-x:visible;
    padding-bottom:0;
  }

  #navToggle{
    display: none;
  }

  #bottom-container{
    background-color: rgb(250, 209, 14);
    width: 100%;
    border-top: calc(5vh + 2vw) solid yellow;
  }

  #bottom-container>nav{
    display: block;
  }

  #bottom-container>nav>ul{
    display: flex;
    justify-content: center;
    flex-direction: row;
    height: 3rem;
  }

  #bottom-container nav>ul>li{
    position: static;
    flex:1;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  #bottom-container nav>ul>li>a{
   padding: 0;
  }

  #bottom-container nav>ul>li>a span.toggle{
    display: none;
  }

  #bottom-container >nav>ul>li>nav>ul>li{
    line-height: 2.5rem;
  }
  #bottom-container>nav>ul>li>nav{
    margin-top:-194.5rem;
  }
}
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<div id="head-wrap">
  <div id="second-wrap">
    <header>
      <div id="navToggle"><a href="#">Menu</a></div>
      <div id='bottom-container'>
        <nav>
          <ul>
            <li><a href="#">ITEM ONE</a></li>
            <li class="sub1">
              <a href="#">ITEM TWO <span class="toggle">Expand</span></a>
            <nav>
              <ul>
                <li><a href="#">Sub Item 1</a></li>
                <li><a href="#">Sub Item 2</a></li>
                <li><a href="#">Sub Item 3</a></li>
                <li><a href="#">Sub Item 4</a></li>
              </ul>
            </nav>
            <li><a href="#">ITEM THREE</a></li>
          </ul>
        </nav>
      </div>
    </header>
  </div>
</div>


<main>
  <div>
  <p>now you can see this text</p>
  <p>line 1</p>
  <p>line 2</p>
  <p>line 3</p>
  <p>line 4</p>
  <p>line 5</p>
  <p>line 6</p>
  <p>line 7</p>
  <p>line 8</p>
  <p>line 9</p>
  <p>line 10</p>
    <p>line 11</p>
    <p>line 12</p>
    <p>line 13</p>
    <p>line 14</p>
    <p>line 15</p>
    <p>line 16</p>
    <p>line 17</p>
    <p>line 18</p>
    <p>line 19</p>
    <p>line 20</p>
    </div>
</main>
</body>
</html>


感谢您提供的创新解决方案,但看起来像Google不太喜欢的代码。重复和隐藏的导航级别内容。我真的希望有一个我根本不知道的定位技巧,但是我开始意识到jQuery解决方案是解决此问题的最佳方法。我将保留悬赏金,以查看是否有其他可用的解决方案。如果没有其他人提出来,我会将您的答案标记为正确。
奥斯丁

@Austin是的,很酷。我也有兴趣查看其他解决方案。
whatEvery

@奥斯汀我已经用一个更好的解决方案更新了答案。
每年

0

一个简单的修正中,我使用padding%而不是rempx

$(document).ready(function() {
  $('#navToggle').click(function() {
    $("div#bottom-container > nav").slideToggle();
  });

  $(window).resize(function() {
    if (window.innerWidth >= "751") {
      $("header > div#bottom-container > nav").show();
    } else {
      $("header > div#bottom-container > nav").hide();
    }
  });

  $("header > div#bottom-container > nav > ul > li > a").click(function(e) {
    if (window.innerWidth <= "750") {
      if ($(this).siblings().size() > 0) {
        e.preventDefault();
        $(this).siblings().slideToggle("slow");
      }
    }
  });

  $("header > div#bottom-container > nav > ul > li").hover(function() {
    if (window.innerWidth >= "751") {
      if ($(this).children("nav").size() > 0) {
        $(this).children("nav").stop().show();
      }
    }
  }, function() {
    if (window.innerWidth >= "751") {
      if ($(this).children("nav").size() > 0) {
        $(this).children("nav").hide();
      }
    }
  });
});
* {
  margin: 0;
}

@media (min-width: 48rem) {
   :root {
    font-size: calc(1rem + ((1vw - .48rem) * 1.389));
  }
}

body {
  background: #eee;
  font-family: "HelveticaNeue-Light", Arial;
  height: auto !important;
}

#head-wrap {
  margin: 0 auto;
  position: relative;
  width: 100%;
}

#second-wrap {
  position: fixed;
  width: 100%;
  z-index: 999;
}

main {
  height: 4000px;
  position: relative;
  padding-top: 13rem;
}

header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  height: 200rem;
}

#navToggle {
  background-color: rgba(0, 0, 0, .15);
  position: relative;
  right: 0;
  top: 0;
  z-index: 999;
  height: 2.6rem;
}

#navToggle>a {
  color: rgba(255, 255, 255, .85);
  display: block;
  font-size: 0.85em;
  font-weight: 600;
  padding: 0 2.5rem;
  text-decoration: none;
  transition: all 300ms ease;
  padding-top: .9rem;
}

#bottom-container {
  display: flex;
  flex-direction: column;
  text-align: center;
  box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
}

#bottom-container>nav {
  background-color: rgb(250, 209, 14);
  display: none;
  flex: 1;
}

#bottom-container nav>ul {
  list-style-type: none;
}

#bottom-container nav>ul>li {
  position: relative;
}

#bottom-container nav>ul>li>a {
  display: block;
  color: rgba(0, 0, 0, .65);
  padding: 1.3rem 0;
  text-decoration: none;
}

#bottom-container nav>ul>li>a span.toggle {
  background-color: rgba(0, 0, 0, .05);
  color: rgba(0, 0, 0, .25);
  padding: 2px 8px;
}

#bottom-container>nav>ul>li>nav {
  display: none;
  overflow: hidden;
  position: absolute;
  top: 100%;
  right: 5%;
  width: 90%;
  z-index: 100;
  background-color: rgb(250, 250, 250);
  margin-bottom: 10rem;
}

header>nav>ul>li>nav>ul>li>a {
  color: rgba(255, 255, 255, .85);
}


/*
/////////////////////////////////////////////////
/////////////////////////////////////////////////
////   Use padding in %  //////////
*/

main {
  padding-top: 11%;
}

@media (max-width:1200px) {
  main {
  padding-top: 12.5%;
}
}

@media (max-width:1023px) {
 main {
  padding-top: 14.5%;
}
}

@media (max-width:767px) {
  main {
  padding-top: 8%;
}
}


/*
////////////////////////////////////////////////
////////////////////////////////////////////////
*/


/* Medium screens */

@media all and (min-width: 751px) {
  header {
    overflow-y: visible;
    overflow-x: visible;
    padding-bottom: 0;
  }
  #navToggle {
    display: none;
  }
  #bottom-container {
    background-color: rgb(250, 209, 14);
    width: 100%;
    border-top: calc(5vh + 2vw) solid yellow;
  }
  #bottom-container>nav {
    display: block;
  }
  #bottom-container>nav>ul {
    display: flex;
    justify-content: center;
    flex-direction: row;
    height: 3rem;
  }
  #bottom-container nav>ul>li {
    position: static;
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  #bottom-container nav>ul>li>a {
    padding: 0;
  }
  #bottom-container nav>ul>li>a span.toggle {
    display: none;
  }
  #bottom-container>nav>ul>li>nav>ul>li {
    line-height: 2.5rem;
  }
  #bottom-container>nav>ul>li>nav {
    margin-top: -194.5rem;
  }
}
<html>

<head>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>

<body>
  <div id="head-wrap">
    <div id="second-wrap">
      <header>
        <div id="navToggle"><a href="#">Menu</a></div>
        <div id='bottom-container'>
          <nav>
            <ul>
              <li><a href="#">ITEM ONE</a></li>
              <li class="sub1">
                <a href="#">ITEM TWO <span class="toggle">Expand</span></a>
                <nav>
                  <ul>
                    <li><a href="#">Sub Item 1</a></li>
                    <li><a href="#">Sub Item 2</a></li>
                    <li><a href="#">Sub Item 3</a></li>
                    <li><a href="#">Sub Item 4</a></li>
                  </ul>
                </nav>
                <li><a href="#">ITEM THREE</a></li>
            </ul>
          </nav>
        </div>
      </header>
    </div>
  </div>

  <main>
    <p>content top not visible but should be able to see</P>
    <p>line 1</P>
    <p>line 2</P>
    <p>line 3</P>
    <p>line 4</P>
    <p>line 5</P>
    <p>line 6</P>
    <p>line 7</P>
    <p>line 8</P>
    <p>line 9</P>
    <p>line 10</P>
    <p>line 11</P>
    <p>line 12</P>
    <p>line 13</P>
    <p>line 14</P>
    <p>line 15</P>
    <p>line 16</P>
    <p>line 17</P>
    <p>line 18</P>
    <p>line 19</P>
    <p>line 20</P>
  </main>
</body>

</html>


如果窗口宽约900像素,则顶行仍会被截断。
每年

@thingEvery更新了我使用media-quires病假的方法来调整填充的效果,请检查并告知我
Awais

这样比较好,但是某些文本仍会在751px至767px之间被截断。另外,OP指出:“在<header>中放置几个​​使用相对或基于百分比的高度的元素时,顶部填充的想法变得更糟。” 我可能只是走jQuery路线,但是除此之外,创建一堆媒体查询可能是他唯一的选择-只要他头文件中的元素不会改变。
somethingEveryJan

1
我刚刚创建了主要由设备使用的查询,他可以相应地进行更改,或者在700到767之间使用一个查询。n秒我同意您的看法,通常标题应该固定高度,由于这个原因,我们有很多选择正确纠正内容的位置,否则就像您提到的那样,Jquery是唯一可以使用的选项……
Awais

0

您不是在寻找位置最高:0; ?您想拥有一个在用户向右滚动时跟随用户的菜单吗?然后尝试将#bottom-container更改为:

#bottom-container {
  display: flex;
  flex-direction: column;
  text-align: center;
  box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
  position: sticky;
  top: 0;
  z-index: 1; 
}

我想就是这样。但是可以肯定的是-您需要重新考虑如何创建所有这种结构,因为它太混乱了。您可以通过以下方法获得相同的结果:

的HTML:

<header>
    <nav id="mobileMenu"><a href="#">Menu</a></nav>
    <nav id='menu'>
      <div class="menuItem">
        <a href="#">ITEM ONE</a>
      </div>
      <div class="bigMenuItem">
        HOVER ME
        <div class="menuItemsCon">
          <div class="menuItem"><a href="#">Sub Item 1</a></div>
          <div class="menuItem"><a href="#">Sub Item 2</a></div>
          <div class="menuItem"><a href="#">Sub Item 3</a></div>
          <div class="menuItem"><a href="#">Sub Item 4</a></div>
        </div>
      </div>
      <label class="bigMenuItem" for="inputClick">
        CLICK ME
        <input type="checkbox" name="input" id="inputClick" style="display:none;">
        <div class="menuItemsCon click">
          <div class="menuItem"><a href="#">Sub Item 1</a></div>
          <div class="menuItem"><a href="#">Sub Item 2</a></div>
          <div class="menuItem"><a href="#">Sub Item 3</a></div>
          <div class="menuItem"><a href="#">Sub Item 4</a></div>
        </div>
      </label>
    </nav>
  </header>

  <main>
    <p>content top not visible but should be able to see</P>
    <p>line 1</P>
    <p>line 2</P>
    <p>line 3</P>
    <p>line 4</P>
    <p>line 5</P>
    <p>line 6</P>
    <p>line 7</P>
    <p>line 8</P>
    <p>line 9</P>
    <p>line 10</P>
  </main>

style.css:

* {
  margin: 0;
}

@media (min-width: 48rem) {
  :root {
    font-size: calc(1rem + ((1vw - .48rem) * 1.389));
  }
}

body {
  background: #eee;
  font-family: "HelveticaNeue-Light", Arial;
  height: auto !important;
}
main{
  height:100vh;
  position:relative;
}

/*Changed classes*/

header{
  position: sticky;
  top:0;
  z-index: 1;
}

a{
  display: block;
  color: rgba(0, 0, 0, .65);
  text-decoration: none;
  width: 100%;
  height: 100%;
}

#mobileMenu{
  display: none;
  background-color: rgba(0, 0, 0, .15);
  height: 2.6rem
}

#mobileMenu a{
  color:rgba(255, 255, 255, .85);
  display: block;
  font-size: 0.85em;
  font-weight: 600;
  padding: 0 2.5rem;
  text-decoration: none;
  transition: all 300ms ease;
  padding-top: .9rem;
}

#menu{
  background-color: rgb(250, 209, 14);
  border-top: calc(5vh + 2vw) solid yellow;
  display: flex;
  z-index: 999;
  box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
}

@media only screen and (max-width:751px) {
  #mobileMenu{
    display: block;
  }
  #menu{
    display: none;
  }
}

#menu > .menuItem, #menu > .bigMenuItem{
  width: calc(100%/3);
  height: 3rem;
  text-align: center;
  line-height: 3rem;
}

#menu > .bigMenuItem{
  position: relative;
  cursor: pointer;
}

#menu > .bigMenuItem .menuItemsCon{
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  z-index: -1;
  opacity: 0;
  position: relative;
  top: -100vh;
  transition: all .5s;
}


#menu > .bigMenuItem .menuItemsCon > .menuItem{
  height: 3rem;
  background-color: #FFF;
}

/* and if you want to click for submenu to show*/
#menu  .bigMenuItem input:checked + .menuItemsCon, #menu  .bigMenuItem:hover .menuItemsCon:not(.click){
  opacity: 1;
  top: 0;
}

如果您不必使用它,则无需JS cuz。我希望这有帮助。


0

我可以为您提供Vanilla-JavaScript而不是jQuery…

尝试在页面加载时获取“标头”的大小(onload事件),并将其添加到“ main”的填充中:

window.addEventListener("load", function(e){
  my_main.style.paddingTop = my_header.clientHeight + "px";
}, 1);

为了工作,我给“ header”和“ main”元素赋予了“ id”:

<header id="my_header"> <main id="my_main">

window.addEventListener("load", function(e){
  my_main.style.paddingTop = my_header.clientHeight + "px";
}, 1);
* {
    margin: 0;
}
  
@media (min-width: 48rem) {
    :root {
        font-size: calc(1rem + ((1vw - .48rem) * 1.389));
    }
}
  
body {
    background: #eee;
    font-family: "HelveticaNeue-Light", Arial;
    height: auto !important;
 }

header {
    width: 100%;
    position: sticky;
    top: 0;
    box-shadow: 2px 5px 10px 1px rgba(0, 0, 0, 0.55);
}

.wrapper {
    position: relative;
    background-color: rgba(0, 0, 0, .15);
}

#navToggle {
    display: inline-block;
    height: 2.6rem;
}

#navToggle > a {
    color: rgba(255, 255, 255, .85);
    display: block;
    font-size: 0.85em;
    font-weight: 600;
    padding: 0 2.5rem;
    text-decoration: none;
    transition: all 300ms ease;
    padding-top: .9rem;
}

#navToggle:hover + #bottom-container, #bottom-container:hover  {
    visibility: visible;
    opacity: 1;
    transition: all 0.2s ease-in-out;
}

#bottom-container {
    background-color: rgb(250, 209, 14);
    width: 100%;
    visibility: hidden;
    opacity: 0;
    position: absolute;
    top: 100%;
    left: 0;
}

#bottom-container > nav  ul {
    margin: 0;
    padding: 0;
    list-style-type: none;
}

#bottom-container > nav > ul {
    display: flex;
    flex-direction: column;
    flex: 1;
    align-items: center;
}

#bottom-container > nav > ul li {
    display: flex;
    justify-content: center;
    width: 100%;

}

#bottom-container nav > ul > li > a {
    display: block;
    color: rgba(0, 0, 0, .65);
    padding: 1.3rem 0;
    text-decoration: none;
}

.sub1 {
    position: relative;
}

.sub1 > nav {
    position: absolute;
    top: 100%;
    left: 0;
    visibility: hidden;
    opacity: 0;
    background-color: rgb(250, 250, 250);
    width: 100%;
    transition: all 0.2s ease-in-out;
}

.sub1 > nav ul li {
    text-align: center;
}

.sub1 > a:hover + nav, .sub1 > a + nav:hover {
    visibility: visible;
    opacity: 1;
    transition: all 0.2s ease-in-out;
}

#bottom-container nav>ul>li>a span.toggle {
    background-color: rgba(0, 0, 0, .05);
    color: rgba(0, 0, 0, .25);
    padding: 2px 8px;
}

main {
    height:4000px;
}

@media (min-width: 751px){
    #bottom-container > nav > ul {
        flex-direction: row;
        height: 3rem;
    }
    
    #bottom-container nav>ul>li>a span.toggle {
        display: none;
    }
    
    #bottom-container {
        height: 100%;
        border-top: calc(5vh + 2vw) solid yellow;
        visibility: visible;
        opacity: 1;
        position: static;
    }

    #navToggle {
        display: none;
    }
}
<!doctype html>

<html lang="en">

<head>
    <meta charset="utf-8">

    <title></title>

    <link rel="stylesheet" href="styles.css">

</head>

<body>
    <header id="my_header">
        <div class="wrapper">
            <div id="navToggle"><a href="#">Menu</a></div>
            <div id='bottom-container'>
                <nav>
                    <ul>
                        <li><a href="#">ITEM ONE</a></li>
                        <li class="sub1">
                            <a href="#">ITEM TWO <span class="toggle">Expand</span></a>
                            <nav>
                                <ul>
                                    <li><a href="#">Sub Item 1</a></li>
                                    <li><a href="#">Sub Item 2</a></li>
                                    <li><a href="#">Sub Item 3</a></li>
                                    <li><a href="#">Sub Item 4</a></li>
                                </ul>
                            </nav>
                        <li><a href="#">ITEM THREE</a></li>
                    </ul>
                </nav>
            </div>
        </div>
        
    </header>


    <main id="my_main">
        <p>content top not visible but should be able to see</P>
        <p>line 1</P>
        <p>line 2</P>
        <p>line 3</P>
        <p>line 4</P>
        <p>line 5</P>
        <p>line 6</P>
        <p>line 7</P>
        <p>line 8</P>
        <p>line 9</P>
        <p>line 10</P>
        <p>line 11</P>
        <p>line 12</P>
        <p>line 13</P>
        <p>line 14</P>
        <p>line 15</P>
        <p>line 16</P>
        <p>line 17</P>
        <p>line 18</P>
        <p>line 19</P>
        <p>line 20</P>
    </main>
</body>

</html>

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.