我对CSS很新,可能会错过一些基本的东西。我从Material Design Lite的教程站点获取HTML表单的代码,但它不发送任何HTTP请求。
我想念什么?
<div class="mdl-layout mdl-js-layout mdl-color--grey-100">
<main class="mdl-layout__content">
<div class="mdl-card mdl-shadow--6dp">
<div class="mdl-card__title mdl-color--primary mdl-color-text--white">
<h2 class="mdl-card__title-text">Acme Co.</h2>
</div>
<div class="mdl-card__supporting-text">
<form action="foo.html">
<div class="mdl-textfield mdl-js-textfield">
<input class="mdl-textfield__input" type="text" id="username" />
<label class="mdl-textfield__label" for="username">Username</label>
</div>
<div class="mdl-textfield mdl-js-textfield">
<input class="mdl-textfield__input" type="password" id="userpass" />
<label class="mdl-textfield__label" for="userpass">Password</label>
</div>
</form>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect">Log in</button>
</div>
</div>
</main>
</div>
答案 0 :(得分:2)
将<Button>
放在<form></form>
标记内。
像这样:
<div class="mdl-layout mdl-js-layout mdl-color--grey-100">
<main class="mdl-layout__content">
<div class="mdl-card mdl-shadow--6dp">
<div class="mdl-card__title mdl-color--primary mdl-color-text--white">
<h2 class="mdl-card__title-text">Acme Co.</h2>
</div>
<div class="mdl-card__supporting-text">
<form action="foo.html">
<div class="mdl-textfield mdl-js-textfield">
<input class="mdl-textfield__input" type="text" id="username" />
<label class="mdl-textfield__label" for="username">Username</label>
</div>
<div class="mdl-textfield mdl-js-textfield">
<input class="mdl-textfield__input" type="password" id="userpass" />
<label class="mdl-textfield__label" for="userpass">Password</label>
</div>
<div class="mdl-card__actions mdl-card--border">
<button class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect" type="submit" name="login">Log in</button>
</div>
</form>
</div>
</div>
</main>
</div>
答案 1 :(得分:1)
<button class="mdl-button mdl-button--colored mdl-js-button mdl-js-ripple-effect" type="submit" name="action">Submit</button>
使用此选项,您使用的是一个简单的按钮,但是php表单接受带有操作的提交类型按钮。
答案 2 :(得分:-6)