实现:如何向输入字段提交按钮添加图标?

时间:2019-02-18 10:02:51

标签: frameworks materialize

我正在尝试基于Materialize-css构建待办事项应用程序。我希望输入字段与提交按钮位于同一行,其中应包含一个实现图标。这就是我目前所拥有的:

<div class="col s12">
        Hinzufügen
          <div class="input-field inline">
            <input id="todo" type="email" class="validate">
            <label for="todo">todo</label>
               <input type ="submit" class ="btn waves-effect waves-light inline" value = "Submit"/>
          </div>
</div>

这是一张有关当前外观的图片。我只是不知道如何将图标添加到“提交”按钮,因为没有打开和关闭标签,而只是输入标签。我需要输入标签才能在提交后使用php代码。

Todo-App

1 个答案:

答案 0 :(得分:0)

您只需将input标签替换为示例中的button标签,希望对您有所帮助

<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <title>Home</title>

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
     <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

    <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
    
</head>

<body>

    <header>
        <nav>
            <div class="nav-wrapper blue darken-3">
                <a href="#!" class="brand-logo">Charts</a>
                <!-- <a href="#" data-target="mobile-demo" class="sidenav-trigger"><i class="material-icons">menu</i></a> -->
                <ul class="right hide-on-med-and-down">
                    <!-- <li><a href="sass.html">Sass</a></li> -->
                </ul>
            </div>
        </nav>

        <!-- <ul class="sidenav" id="mobile-demo">
            <li><a href="sass.html">Sass</a></li>
        </ul> -->
    </header>


    <main >
        <div class="col s12">
        Hinzufügen
          <div class="input-field inline">
            <input id="todo" type="email" class="validate">
            <label for="todo">todo</label>
            <button class="btn waves-effect waves-light" type="submit" name="action">Submit
              <i class="material-icons right">send</i>
            </button>
          </div>
        </div>

    </main>


    <footer>

    </footer>
</body>

</html>