我创建了一个简单的 MDC 卡,上面有一些 MDC 文本字段按钮。但是,文本框无法正确呈现。从下图可以看出,右上角和左上角有空隙。下面是我的代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Material Card Example</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700">
<link rel="stylesheet" href="https://unpkg.com/material-components-web/dist/material-components-web.min.css">
</head>
<body>
<div class="mdc-card">
<div class="">
<div class="card-header">
<div class="mdc-card__actions">
<div class="mdc-text-field mdc-text-field--box username">
<input type="text" class="text-field--outlined" id="username-input" name="username" required>
<label class="mdc-floating-label" for="username-input">Email</label>
<div class="mdc-line-ripple"></div>
</div>
</div>
<div class="mdc-card__actions">
<div class="mdc-text-field mdc-text-field--box password">
<input type="password" class="text-field--outlined" id="password-input" name="password" required minlength="8">
<label class="mdc-floating-label" for="password-input">Password</label>
<div class="mdc-line-ripple"></div>
</div>
</div>
</div>
<script src="https://unpkg.com/material-components-web/dist/material-components-web.min.js"></script>
</body>
</html>