设置导航栏以使用媒体查询滚动。 css html

Setting nav bar to scroll with a media query. css html

大家好,当我的页面全屏时,主要内容滚动并且导航固定。

我想做的是将导航设置为更小的高度(例如 250 像素)并让导航链接滚动占用更少 space。

设置为滚动时我看不到所有导航。

代码如下!我使用了未显示的 CSS 样式重置。

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="styles.css">
    <title>Javascript page</title>
</head>
<body>
<div id="wrapper">
    <header>
    <nav>
<h1>JS DOCUMENTATION</h1>
<ul class="navlinks">
    <li class="navlink"><a class="link" href="#intro">Introduction</a></li>
    <li class="navlink"><a href="#what2">What you should already know</a></li>
    <li class="navlink"><a href="#java3">Javascript and Java</a></li>
    <li class="navlink"><a href="#hello4">Hello world</a></li>
    <li class="navlink"><a href="#var5">Variables</a></li>
    <li class="navlink"><a href="#decl6">Declaring Variables</a></li>
    <li class="navlink"><a href="#var6">Variable Scope</a></li>
    <li class="navlink"><a href="#glob7">Global variables</a></li>
    <li class="navlink"><a href="#const8">Constants</a></li>
    <li class="navlink"><a href="data9">Data types</a></li>
</ul>
    </nav>
    </header>

    <main>
        <section class="intro" id="intro1">
            <h2 class="section-title">Introduction</h2>

            <p class="content">
                JavaScript is a cross-platform, object-oriented scripting language. It is a small and lightweight language. Inside a
                host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide
                programmatic control over them.
            </p>
            <p class="content">
                JavaScript contains a standard library of objects, such as Array, Date, and Math, and a core set of language elements
                such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by
                supplementing it with additional objects; for example:
            </p>

            <ul class="content-bullet">
                <li class="bullet">Client-side JavaScript extends the core language by supplying objects to control a browser and its Document Object Model
                (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user
                events such as mouse clicks, form input, and page navigation.</li>
                <li class="bullet">Server-side JavaScript extends the core language by supplying objects relevant to running JavaScript on a server. For example, server-side extensions allow an application to communicate with a database, provide continuity of information
                from one invocation to another of the application, or perform file manipulations on a server.</li>
            </ul>
        </section>

        <section class="What-you-know" id="what2">
            <h2 class="section-title">What you should already know</h2>

            <p class="content">
                This guide assumes you have the following basic background:
            </p>

            <ul class="content-bullet">
                <li class="bullet">A general understanding of the Internet and the World Wide Web (WWW).</li>
                <li class="bullet">Good working knowledge of HyperText Markup Language (HTML).</li>
                <li class="bullet">Some programming experience. If you are new to programming, try one of the tutorials linked on the main page about JavaScript.</li>
                </ul>

        </section>

        <section class="java" id="java3">
            <h2 class="section-title">Javascript and Java</h2>
            <p class="content">
            JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression
            syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript to
            JavaScript.</p>

            <p class="content">
                In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based
                on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based
                object model instead of the more common class-based object model. The prototype-based model provides dynamic
                inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any
                special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.
            </p>




        </section>

        <section class="Hello-world" id="hello4">
                <h2 class="section-title">Hello World</h2>
                <p class="content">
                    To get started with writing JavaScript, open the Scratchpad and write your first "Hello world" JavaScript code:
                </p>
                <code>
                    function greetMe(yourName) { alert("Hello " + yourName); }
                    greetMe("World");
                </code>

                <p class="content">
                    Select the code in the pad and hit Ctrl+R to watch it unfold in your browser!
                </p>

        </section>

        <section class="Variables" id="var5">
            <h2 class="section-title">Variables</h2>
            <p class="content">
                You use variables as symbolic names for values in your application. The names of variables, called identifiers, conform
                to certain rules.
                
                A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($); subsequent characters can also be
                digits (0-9). Because JavaScript is case sensitive, letters include the characters "A" through "Z" (uppercase) and the
                characters "a" through "z" (lowercase).
                
                You can use ISO 8859-1 or Unicode letters such as å and ü in identifiers. You can also use the Unicode escape sequences
                as characters in identifiers. Some examples of legal names are Number_hits, temp99, and _name.
            </p>

        </section>

        <section class="Declaring-variables" id="decl6">
            <h2 class="section-title">Declaring variables</h2>
                        <p class="content">
                            JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language
                            resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java
                            expression
                            syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript
                            to
                            JavaScript.</p>
                        
                        <p class="content">
                            In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system
                            based
                            on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based
                            object model instead of the more common class-based object model. The prototype-based model provides dynamic
                            inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without
                            any
                            special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.
                        </p>
        </section>

        <section class="Variable-scope" id="var6">
            <h2 class="section-title">Variable-scope</h2>
                        <p class="content">
                            JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language
                            resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java
                            expression
                            syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript
                            to
                            JavaScript.</p>
                        
                        <p class="content">
                            In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system
                            based
                            on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based
                            object model instead of the more common class-based object model. The prototype-based model provides dynamic
                            inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without
                            any
                            special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.
                        </p>
        </section>

        <section class="Global-variables" id="glob7">
            <h2 class="section-title">Global Variables</h2>
                        <p class="content">
                            JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language
                            resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java
                            expression
                            syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript
                            to
                            JavaScript.</p>
                        
                        <p class="content">
                            In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system
                            based
                            on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based
                            object model instead of the more common class-based object model. The prototype-based model provides dynamic
                            inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without
                            any
                            special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.
                        </p>
        </section>

        <section class="Constants" id="const8">
            <h2 class="section-title">Constants</h2>
                        <p class="content">
                            JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language
                            resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java
                            expression
                            syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript
                            to
                            JavaScript.</p>
                        
                        <p class="content">
                            In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system
                            based
                            on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based
                            object model instead of the more common class-based object model. The prototype-based model provides dynamic
                            inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without
                            any
                            special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.
                        </p>
        </section>

        <section class="Data-types" id="data9">
            <h2 class="section-title">Data types</h2>
                        <p class="content">
                            JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language
                            resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java
                            expression
                            syntax, naming conventions and basic control-flow constructs which was the reason why it was renamed from LiveScript
                            to
                            JavaScript.</p>
                        
                        <p class="content">
                            In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system
                            based
                            on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based
                            object model instead of the more common class-based object model. The prototype-based model provides dynamic
                            inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without
                            any
                            special declarative requirements. Functions can be properties of objects, executing as loosely typed methods.
                        </p>
        </section>
    </main>
    </div>
</body>
</html>

<styles>
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}
body {
  line-height: 1;
}
/* ol,
ul {
  list-style: none;
} */
blockquote,
q {
  quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Lato:wght@400;700;900&family=Montserrat:wght@100&display=swap");

* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  overflow: hidden;
  font-family: "Lato", sans-serif;
}

#wrapper {
  display: flex;
  height: 100%;
}

header {
  border-right: solid grey 2px;
}

h1 {
  font-size: 1.5rem;
  padding: 20px 20px;
  color: black;
}

nav {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.navlink {
  list-style-type: none;
  border-top: solid black 1px;
  padding: 10px 10px;
}

a {
  text-decoration: none;
  color: rgb(77, 75, 75);
}

main {
  overflow: auto;
  width: 700px;
  flex-grow: 1;
  padding: 30px 50px;
  color: rgb(77, 75, 75);
}

.section-title {
  font-size: 1.5rem;
  padding: 20px 0px;
  color: black;
}

.content {
  padding: 10px 10px;
  word-spacing: 0.2em;
}

.content-bullet {
  padding: 15px 40px;
}

.bullet {
  padding: 10px 0px;
}

@media (max-width: 768px) {
  #wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
  }

  header {
    border-right: solid white 2px;
  }

  body {
    overflow: hidden;
  }

  main {
    width: 100%;
    flex-grow: 1;
    padding: 20px 10px;
    color: rgb(77, 75, 75);
  }


  nav {
    height: 200px;
    overflow: scroll;
  }

  .navlink {
    list-style-type: none;
    border-top: solid black 1px;
    border-bottom: solid black 1px;
    padding: 10px 10px;
  }
}
</styles>

给你...

将此添加到您的 CSS:

.navlinks {
  overflow-y: scroll;
  height: 250px;
}

请参阅下面的代码段。

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}


/* HTML5 display-role reset for older browsers */

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}

body {
  line-height: 1;
}


/* ol,
ul {
  list-style: none;
} */

blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

@import url("https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Lato:wght@400;700;900&family=Montserrat:wght@100&display=swap");
* {
  box-sizing: border-box;
}

body {
  height: 100vh;
  overflow: hidden;
  font-family: "Lato", sans-serif;
}

#wrapper {
  display: flex;
  height: 100%;
}

header {
  border-right: solid grey 2px;
}

h1 {
  font-size: 1.5rem;
  padding: 20px 20px;
  color: black;
}

nav {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.navlink {
  list-style-type: none;
  border-top: solid black 1px;
  padding: 10px 10px;
}

a {
  text-decoration: none;
  color: rgb(77, 75, 75);
}

main {
  overflow: auto;
  width: 700px;
  flex-grow: 1;
  padding: 30px 50px;
  color: rgb(77, 75, 75);
}

.section-title {
  font-size: 1.5rem;
  padding: 20px 0px;
  color: black;
}

.content {
  padding: 10px 10px;
  word-spacing: 0.2em;
}

.content-bullet {
  padding: 15px 40px;
}

.bullet {
  padding: 10px 0px;
}

@media (max-width: 768px) {
  #wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  header {
    border-right: solid white 2px;
  }
  body {
    overflow: hidden;
  }
  main {
    width: 100%;
    flex-grow: 1;
    padding: 20px 10px;
    color: rgb(77, 75, 75);
  }
  nav {
    height: 200px;
    overflow: scroll;
  }
  .navlink {
    list-style-type: none;
    border-top: solid black 1px;
    border-bottom: solid black 1px;
    padding: 10px 10px;
  }
}

.navlinks {
  overflow-y: scroll;
  height: 250px;
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="styles.css">
  <title>Javascript page</title>
</head>

<body>
  <div id="wrapper">
    <header>
      <nav>
        <h1>JS DOCUMENTATION</h1>
        <ul class="navlinks">
          <li class="navlink"><a class="link" href="#intro">Introduction</a></li>
          <li class="navlink"><a href="#what2">What you should already know</a></li>
          <li class="navlink"><a href="#java3">Javascript and Java</a></li>
          <li class="navlink"><a href="#hello4">Hello world</a></li>
          <li class="navlink"><a href="#var5">Variables</a></li>
          <li class="navlink"><a href="#decl6">Declaring Variables</a></li>
          <li class="navlink"><a href="#var6">Variable Scope</a></li>
          <li class="navlink"><a href="#glob7">Global variables</a></li>
          <li class="navlink"><a href="#const8">Constants</a></li>
          <li class="navlink"><a href="data9">Data types</a></li>
        </ul>
      </nav>
    </header>

    <main>
      <section class="intro" id="intro1">
        <h2 class="section-title">Introduction</h2>

        <p class="content">
          JavaScript is a cross-platform, object-oriented scripting language. It is a small and lightweight language. Inside a host environment (for example, a web browser), JavaScript can be connected to the objects of its environment to provide programmatic control
          over them.
        </p>
        <p class="content">
          JavaScript contains a standard library of objects, such as Array, Date, and Math, and a core set of language elements such as operators, control structures, and statements. Core JavaScript can be extended for a variety of purposes by supplementing it
          with additional objects; for example:
        </p>

        <ul class="content-bullet">
          <li class="bullet">Client-side JavaScript extends the core language by supplying objects to control a browser and its Document Object Model (DOM). For example, client-side extensions allow an application to place elements on an HTML form and respond to user events
            such as mouse clicks, form input, and page navigation.</li>
          <li class="bullet">Server-side JavaScript extends the core language by supplying objects relevant to running JavaScript on a server. For example, server-side extensions allow an application to communicate with a database, provide continuity of information from
            one invocation to another of the application, or perform file manipulations on a server.</li>
        </ul>
      </section>

      <section class="What-you-know" id="what2">
        <h2 class="section-title">What you should already know</h2>

        <p class="content">
          This guide assumes you have the following basic background:
        </p>

        <ul class="content-bullet">
          <li class="bullet">A general understanding of the Internet and the World Wide Web (WWW).</li>
          <li class="bullet">Good working knowledge of HyperText Markup Language (HTML).</li>
          <li class="bullet">Some programming experience. If you are new to programming, try one of the tutorials linked on the main page about JavaScript.</li>
        </ul>

      </section>

      <section class="java" id="java3">
        <h2 class="section-title">Javascript and Java</h2>
        <p class="content">
          JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions
          and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.
        </p>

        <p class="content">
          In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead
          of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements.
          Functions can be properties of objects, executing as loosely typed methods.
        </p>




      </section>

      <section class="Hello-world" id="hello4">
        <h2 class="section-title">Hello World</h2>
        <p class="content">
          To get started with writing JavaScript, open the Scratchpad and write your first "Hello world" JavaScript code:
        </p>
        <code>
                    function greetMe(yourName) { alert("Hello " + yourName); }
                    greetMe("World");
                </code>

        <p class="content">
          Select the code in the pad and hit Ctrl+R to watch it unfold in your browser!
        </p>

      </section>

      <section class="Variables" id="var5">
        <h2 class="section-title">Variables</h2>
        <p class="content">
          You use variables as symbolic names for values in your application. The names of variables, called identifiers, conform to certain rules. A JavaScript identifier must start with a letter, underscore (_), or dollar sign ($); subsequent characters can also
          be digits (0-9). Because JavaScript is case sensitive, letters include the characters "A" through "Z" (uppercase) and the characters "a" through "z" (lowercase). You can use ISO 8859-1 or Unicode letters such as å and ü in identifiers. You can
          also use the Unicode escape sequences as characters in identifiers. Some examples of legal names are Number_hits, temp99, and _name.
        </p>

      </section>

      <section class="Declaring-variables" id="decl6">
        <h2 class="section-title">Declaring variables</h2>
        <p class="content">
          JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions
          and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.
        </p>

        <p class="content">
          In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead
          of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements.
          Functions can be properties of objects, executing as loosely typed methods.
        </p>
      </section>

      <section class="Variable-scope" id="var6">
        <h2 class="section-title">Variable-scope</h2>
        <p class="content">
          JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions
          and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.
        </p>

        <p class="content">
          In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead
          of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements.
          Functions can be properties of objects, executing as loosely typed methods.
        </p>
      </section>

      <section class="Global-variables" id="glob7">
        <h2 class="section-title">Global Variables</h2>
        <p class="content">
          JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions
          and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.
        </p>

        <p class="content">
          In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead
          of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements.
          Functions can be properties of objects, executing as loosely typed methods.
        </p>
      </section>

      <section class="Constants" id="const8">
        <h2 class="section-title">Constants</h2>
        <p class="content">
          JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions
          and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.
        </p>

        <p class="content">
          In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead
          of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements.
          Functions can be properties of objects, executing as loosely typed methods.
        </p>
      </section>

      <section class="Data-types" id="data9">
        <h2 class="section-title">Data types</h2>
        <p class="content">
          JavaScript and Java are similar in some ways but fundamentally different in some others. The JavaScript language resembles Java but does not have Java's static typing and strong type checking. JavaScript follows most Java expression syntax, naming conventions
          and basic control-flow constructs which was the reason why it was renamed from LiveScript to JavaScript.
        </p>

        <p class="content">
          In contrast to Java's compile-time system of classes built by declarations, JavaScript supports a runtime system based on a small number of data types representing numeric, Boolean, and string values. JavaScript has a prototype-based object model instead
          of the more common class-based object model. The prototype-based model provides dynamic inheritance; that is, what is inherited can vary for individual objects. JavaScript also supports functions without any special declarative requirements.
          Functions can be properties of objects, executing as loosely typed methods.
        </p>
      </section>
    </main>
  </div>
</body>

</html>

尝试准确指出与您的问题相关的代码部分。

这样就容易多了!

虽然我找不到导航顶部对齐 200 像素的原因。你可以这样修复它。

 .navlink:last-child {
     margin-bottom: 30px;
  }

 .navlink:first-child {
    margin-top: 200px;
 }