最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

html - Is there a way to position a dropdown menu under the selected button in the navigation menu? - Stack Overflow

programmeradmin2浏览0评论

Beginner in CSS, recently I made a navigation menu, and now I want to add a dropdown menu to one of the buttons. However, it seems that the dropdown menu is misaligned and I'm not sure what I can do. I want for it to be under the button I selected. The navigation menu The dropdown menu (misaligned)

.neu-button {
  border: none;
  background-color: #f0f0f3; /* 1 white */
  height:77px;
  width:280px;
  filter: drop-shadow(-2px -2px 7px rgba(255,255,255,0.75)) drop-shadow(4px 4px 15px rgba(0,0,0,0.125));
  border-radius: 16px;
  text-align: center;
  font-size: 1.5em;
  color: #C590EF; /* 400 violet */
  transition: 0.3s;
  margin-left: 10px;
  user-select: none;
  overflow: hidden;
}
.neu-button:hover {
  filter: drop-shadow(-1px -1px 5px rgba(255,255,255,1)) drop-shadow(2px 2px 10px rgba(0,0,0,0.5));
}
.neu-navmenu {
  display: block;
  justify-content: center;
  align-items: center;
  list-style-type: none;
  margin: 0;
  padding: 0;
  text-align: center;
  position: relative;
}
.neu-navmenu li {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin: 10px;
  width: 170px;
}
.neu-button + .dropdown {
  display: none;
  position: absolute;
}
.neu-button:hover + .dropdown {
  display: block;
}
<ul class="neu-navmenu">
  <li class="neu-button">Главная</li>
  <li class="neu-button">Проекты</li>
  <li class="neu-button dropdown">DanganAwful</li>
  <li class="neu-button">Неоморфизм</li>
  <li class="neu-button">Стилизация</li>
  <li class="neu-button">CSS</li>
</ul>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论