首页 > 解决方案 > 如何使用java将项目添加到dropup html/css

问题描述

我有图像,当你将鼠标悬停在它们上面时,会出现一个下拉菜单。我想在网站底部添加一个按钮,将用户输入项添加到下拉菜单。

我曾尝试使用 addTo 但我不知道如何使用它来下拉。

    <!DOCTYPE html>
    <html>
    <head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>

    .dropup-content {
      display: none;
      position: absolute;
      background-color: #f1f1f1;
      min-width: 160px;
      bottom: 50px;
      z-index: 1;
      height: 132px;
      overflow: auto;
    }

    .dropup-content a {
      color: black;
      padding: 12px 16px;
      text-decoration: none;
      display: block;
    }

    .dropup:hover .dropup-content {
      display: block;
    }

    </style>
    </head>
    <body>
    <div class="dropup">
      <img src="https://i.imgur.com/5mXfwr1.jpg">
      <div class="dropup-content">
        <a href="http://www.echoecho.com/htmltext03.htm"target="_blank">PF thing 1</a>
        <a href="#">PF thing 2</a>
        <a href="#">PF thing 3</a>
      </div>
    </div>
    </body>    
    </html>

我基于此示例的代码。它按预期工作,但我需要对其进行修改,以便您可以在单击按钮时添加项目。

标签: javahtmlcss

解决方案


推荐阅读