html - 慢速下拉菜单 CSS

标签 html css

在网站上找到了很多如何操作的建议。我试图让它工作但是是不同类型的下拉菜单。我试图获得一个缓慢下降的 css 下拉菜单。 这是 html -

大多数帮助都以列表框导航栏的形式出现,但我更喜欢这种方法,它的位置很好。

.dropbtn {
  background-color: #4CAF50;
  transition: 0.3s;
  color: white;
  padding: 16px;
  padding-right: 32px;
  font-size: 16px;
  border: none;
  cursor: crosshair;
  border-radius: 2px;
}
/* Dropdown Content (Hidden by Default) */

.dropdown-content {
  display: none;
  position: absolute;
  background-color: #f9f9f9;
  min-width: 160px;
  box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
}
/* Links inside the dropdown */

.dropdown-content a {
  color: black;
  padding: 12px 16px;
  text-decoration: none;
  display: block;
}
/* Change color of dropdown links on hover */

.dropdown-content a:hover {
  background-color: #f1f1f1;
  color: #000000;
}
/* Show the dropdown menu on hover */

.dropdown:hover .dropdown-content {
  display: inline;
}
/* Change the background color of the dropdown button when the dropdown content is shown */

.dropdown:hover .dropbtn {
  background-color: #3e8e41;
  color: #000000;
}
.dropdown1 {
  position: fixed;
  top: 150px;
  left: 50px;
}
.dropdown2 {
  position: fixed;
  top: 150px;
  left: 220px;
}
.dropdown3 {
  position: fixed;
  top: 150px;
  left: 615px;
}
.dropdown4 {
  position: fixed;
  top: 150px;
  left: 1003px;
}
.pageheading {
  font-family: verdana;
  font-size: 85%;
  position: absolute;
  left: 50px;
  top: 210px;
  background-color: #4CAF50;
  border-radius: 6px;
}
.pageparagraph {
  font-family: verdana;
  text-align: justify;
  position: absolute;
  left: 50px;
  top: 290px;
  right: 685px;
  background-color: #4CAF50;
  border-radius: 6px;
}
.logo {
  font-family: verdana;
  font-size: 150%;
  color: white;
  position: fixed;
  top: 10px;
  left: 50px;
  background-color: #4CAF50;
  border-radius: 6px;
}
body {
  background-image: url("ForestBackground.jpg");
  background-repeat: no-repeat;
}
.arrow1 {
  position: fixed;
  top: 166px;
  left: 185;
  transform: rotate(0deg);
  transition: 0.3s;
}
.arrow2 {
  position: fixed;
  top: 166px;
  left: 580;
  transform: rotate(0deg);
  transition: 0.3s;
}
.arrow3 {
  position: fixed;
  top: 166px;
  left: 970;
  transform: rotate(0deg);
  transition: 0.3s;
}
.arrow4 {
  position: fixed;
  top: 166px;
  left: 1130;
  transform: rotate(0deg);
  transition: 0.3s;
}
.dropdown:hover .arrow1 {
  transform: rotate(90deg);
  transition: 0.3s;
}
.dropdown:hover .arrow2 {
  transform: rotate(90deg);
  transition: 0.3s;
}
.dropdown:hover .arrow3 {
  transform: rotate(90deg);
  transition: 0.3s;
}
.dropdown:hover .arrow4 {
  transform: rotate(90deg);
  transition: 0.3s;
}
<div class="dropdown">
  <div class="dropdown1">
    <button class="dropbtn">Climate Change
      <div class="arrow1">&#10162;</div>
    </button>
    <div class="dropdown-content">
      <a href="https://thepotatoshop.com/shop/mash/highland-burgundy-red-1kg/">Greenhouse Gases</a>
      <a href="https://thepotatoshop.com/shop/mash/arran-victory-1kg/">Carbon Dioxide</a>
      <a href="https://thepotatoshop.com/shop/mash/desiree-1kg/">Methane</a>
      <a href="https://thepotatoshop.com/shop/salad/belle-de-fontenay-1kg/">Water Vapour</a>
      <a href="https://thepotatoshop.com/shop/salad/belle-de-fontenay-1kg/">NF3</a>
    </div>
  </div>
</div>

我想要一个下降的、向下滑动的菜单,而不是任何建议 friend 的淡入淡出?

编辑 - 只是编辑这个来感谢所有的帮助!主要是为了让我的帐户能够再次提问,我不知道为什么我被禁止了。请帮忙。爱你们。

最佳答案

https://jsfiddle.net/btLjk40x/2/ ~ 检查这个 fiddle

.dropdown-content {
    overflow: hidden:
    height: 0;
    position: absolute;
    background-color: #f9f9f9;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    transition: all 1s ease-in;
}
.dropdown:hover .dropdown-content {
    height: 200px; // sample height
}

关于html - 慢速下拉菜单 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40381174/

相关文章:

javascript - 是否可以在 HTML5 canvas 中的路径上绘制图像?

html - 如何在过滤器上方带有文本的图像上放置透视过滤器

javascript - Web Audio API Analyzer节点无法按预期工作

jquery - bootstrap3, jquery 尝试垂直对齐

jQuery 淡入/淡出图像背景故障

javascript - 我希望在用户单击播放按钮时更改电台名称

javascript - 静音和取消静音按钮切换 html5 音频

javascript - jquery以循环方式shift生成按钮值

html - CSS:两个背景图像在一个元素上的位置

javascript - 用 child 包裹一组元素