标题图像和固定的导航栏

时间:2018-02-15 13:35:15

标签: html css

我想创建一个首先显示视频的页面,然后在视频下方,我想要一个导航栏,但是当我向下滚动时,我想要修复导航栏。

另外,我真的只想使用CSS,没有JavaScript,绝对没有jQuery

这就是我所拥有的:

        ul {
            list-style-type: none;
            margin: 0;
            padding: 0;
            overflow: hidden;
            background-color: #333;
        }

        li {
            float: left;
        }

        li a {
            display: block;
            color: white;
            text-align: center;
            padding: 14px 16px;
            text-decoration: none;
        }

        li a:hover {
            background-color: #111;
        }
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<video style="height:1000px " src="http://achielvolckaert.be/Slow Motion Apples Falling.mp4" autoplay></video>

<ul>
    <li><a class="active" href="#home">Home</a></li>
    <li><a href="#news">News</a></li>
    <li><a href="#contact">Contact</a></li>
    <li><a href="#about">About</a></li>
</ul>
<p>

    Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.
    Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.
    Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.
    Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.
    Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.
    Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever imagined. Flavors such as Hazelnut, French Vanilla, Chocolate, Dark Roast, Apple Cinnamon, Amaretto, and Butternut, are only a small fraction of what coffee companies have to offer for any consumers who wish to taste something different. Coffee is even offered in a decaffeinated version for those who enjoy the smell and taste of coffee, but wish to stay away from the caffeine. In addition to the many versions and huge variety of flavors, coffee is also offered in an iced/slush version, as well as served with actual ice cubes which have both become a popular alternative to the traditional cup of coffee. Many businesses, both small and big, thrive on the sole sale of coffee and coffee related products (mugs, traveling cups, etc.). The desire to constantly innovate shows that the coffee industry is willing to reach out to the personal preferences and tastes of a nation of coffee drinkers.Coffee is a multi-billion dollar industry that shows signs of continued growth. In the United States alone, hundreds of millions of people drink coffee on a regular basis. It can be to start their day, a midday boost to get them through the remaining hours of their day, or even a comfort drink. Whatever the reason may be, there are millions of people nationwide who have trouble functioning without the caffeine spike that coffee offers. Today, coffee companies are setting out to satisfy the desires of coffee drinkers by offering a huge and seemingly endless variety of new flavors. Of course there is the traditional cream and sugar, or lack thereof (black coffee), but now, anyone interested in trying new flavors will find a much larger selection than ever 
</p>

</body>
</html>

2 个答案:

答案 0 :(得分:4)

您可以使用

ul {
   position: sticky; 
   top: 0;
}

如果您不打算支持IE和Edge我认为。您可以在https://caniuse.com/

查看

答案 1 :(得分:0)

  当导航栏到达顶部时,

位置将固定导航栏。

这会对你有帮助,

.ul{
  top: 0;
  z-index: 100;
  position: sticky;
  width: 100%;
}

试试这个