【发布时间】:2019-05-03 07:33:04
【问题描述】:
我从 2019 年 3 月开始试用 Material Design Web 1.0。
当在其中使用card 和button 时,虽然按钮已设置为mdc-card__actions--full-bleed,但我发现无法将按钮文本居中。所以我的问题是:
如何在本例中正确居中按钮文本?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https://fonts.gstatic.com; script-src 'unsafe-inline' https://unpkg.com; style-src 'unsafe-inline' https://unpkg.com https://fonts.googleapis.com"/>
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Test</title>
<link href="https://unpkg.com/material-components-web@latest/dist/material-components-web.css" rel="stylesheet"/>
<script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.js"></script>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"/>
<style>
.my-card-content
{
padding: 16px;
}
</style>
</head>
<body>
<div class="mdc-card my-card-content">
<div class="mdc-card__actions mdc-card__actions--full-bleed">
<button class="mdc-button mdc-button--raised mdc-card__action mdc-card__action--button" tabindex="0">
<span class="mdc-button__label">Login</span>
</button>
</div>
</div>
</body>
</html>
【问题讨论】:
-
你想使用全角按钮吗?
标签: html css button material-design