如何更改 <md-button> 中的字体样式
How can I change the font style inside <md-button>
我正在使用 AngularJS 和 Material 设计,但困扰我的一件事是我无法完全重现 google 官方使用的样式按钮标签的网站。
Material Deisgn Button Demo
当我使用这样的按钮时:
<md-button class="md-raised md-primary">Start</md-button>
<md-button class="md-raised md-primary"><label>Start</label></md-button>
我得到这样的结果:
我期待有这样的东西:
这与我根据他们网站上提供的源代码编写的代码有点相同
<md-button class="md-raised md-primary">Primary</md-button>
我试过使用 <b></b>
标签而不是标签,但结果是相似的,有些字母不太合适...我是否缺少解决此字体问题的方法?
编辑:我的代码之一的示例。
(function() {
angular
.module("demoApp", [
"ngMaterial",
"app.config",
"app.controller"
]);
})();
.md-button {
min-width: 10em;
}
<!doctype HTML>
<html>
<head>
<link rel="stylesheet" href="../bootstrap/bootstrap.css">
<link rel="stylesheet" href="../material/angular-material.css">
<link rel="stylesheet" href="style/style.css">
</head>
<body ng-app="demoApp">
<div layout="column" style="padding-bottom: 20px;">
<md-toolbar layout="row">
<h1 class="Title">Ten plus ten is {{10+10}}!</h1>
</md-toolbar>
</div>
<div layout="row">
<div>
</div>
<div layout="column">
<div layout="row">
<div flex="25" flex-sm="0" flex-md="0"></div>
<div flex class="md-whiteframe-z1" layout="column" style="margin-bottom: 15px;">
<md-toolbar class="md-primary">
<div class="md-toolbar-tools">
<span class="md-flex">Parameters</span>
</div>
</md-toolbar>
<md-content class="md-padding">
<p>Lorem ipsum dolor sit amet, ne quod novum mei. Sea omnium invenire mediocrem at, in lobortis conclusionemque nam. Ne deleniti appetere reprimique pro, inani labitur disputationi te sed. At vix sale omnesque, id pro labitur reformidans accommodare,
cum labores honestatis eu. Nec quem lucilius in, eam praesent reformidans no. Sed laudem aliquam ne.
</p>
<p>
Facete delenit argumentum cum at. Pro rebum nostrum contentiones ad. Mel exerci tritani maiorum at, mea te audire phaedrum, mel et nibh aliquam. Malis causae equidem vel eu. Noster melius vis ea, duis alterum oporteat ea sea. Per cu vide munere fierent.
</p>
<div>
<div layout="column" ng-controller="ParametersController as params">
<md-content class="md-padding">
<div layout layout-sm="column">
<md-input-container flex>
<label>Parameter 1</label>
<input ng-model="params.param1" placeholder="placehold text">
</md-input-container>
<md-input-container flex>
<label>Parameter 2</label>
<input ng-model="params.param2" placeholder="placehold text">
</md-input-container>
</div>
<div layout layout-sm="column">
<md-input-container flex>
<label>Parameter 3</label>
<input ng-model="params.param3" placeholder="placehold text">
</md-input-container>
<md-input-container flex>
<label>Parameter 4</label>
<input ng-model="params.param4" placeholder="placehold text">
</md-input-container>
</div>
</md-content>
</div>
<div layout="row" layout-align="end center">
<div></div>
<md-button class="md-raised md-primary" ng-click="sendParameters()">Primary</md-button>
</div>
</div>
</md-content>
</div>
<div flex="25" flex-sm="0" flex-md="0"></div>
</div>
<div layout="row">
<div flex="25" flex-sm="0" flex-md="0"></div>
<div flex class="md-whiteframe-z1" layout="column" style="margin-bottom: 15px;">
<md-toolbar class="md-primary">
<div class="md-toolbar-tools">
<span class="md-flex">Algorithm</span>
</div>
</md-toolbar>
<md-content class="md-padding">
<p>Lorem ipsum dolor sit amet, ne quod novum mei. Sea omnium invenire mediocrem at, in lobortis conclusionemque nam. Ne deleniti appetere reprimique pro, inani labitur disputationi te sed. At vix sale omnesque, id pro labitur reformidans accommodare,
cum labores honestatis eu. Nec quem lucilius in, eam praesent reformidans no. Sed laudem aliquam ne.
</p>
<p>
Facete delenit argumentum cum at. Pro rebum nostrum contentiones ad. Mel exerci tritani maiorum at, mea te audire phaedrum, mel et nibh aliquam. Malis causae equidem vel eu. Noster melius vis ea, duis alterum oporteat ea sea. Per cu vide munere fierent.
</p>
</md-content>
</div>
<div flex="25" flex-sm="0" flex-md="0"></div>
</div>
<div layout="row">
<div flex="25" flex-sm="0" flex-md="0"></div>
<div flex class="md-whiteframe-z1" layout="column" style="margin-bottom: 15px;">
<md-toolbar class="md-accent">
<div class="md-toolbar-tools">
<span class="md-flex">Video</span>
</div>
</md-toolbar>
<md-content class="md-padding">
<p>Lorem ipsum dolor sit amet, ne quod novum mei. Sea omnium invenire mediocrem at, in lobortis conclusionemque nam. Ne deleniti appetere reprimique pro, inani labitur disputationi te sed. At vix sale omnesque, id pro labitur reformidans accommodare,
cum labores honestatis eu. Nec quem lucilius in, eam praesent reformidans no. Sed laudem aliquam ne.
</p>
<p>
Facete delenit argumentum cum at. Pro rebum nostrum contentiones ad. Mel exerci tritani maiorum at, mea te audire phaedrum, mel et nibh aliquam. Malis causae equidem vel eu. Noster melius vis ea, duis alterum oporteat ea sea. Per cu vide munere fierent.
</p>
</md-content>
</div>
<div flex="25" flex-sm="0" flex-md="0"></div>
</div>
</div>
</div>
<!-- Angular Material Dependencies -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-animate.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-route.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angular_material/0.7.1/angular-material.min.js"></script>
<script src="app.module.js"></script>
<script src="app.config.js"></script>
<script src="app.contoller.js"></script>
</body>
</html>
在您链接到的演示页面上,它还在外部样式表之外的页面上添加了一些样式。
此样式为:
.buttondemoBasicUsage section .md-button:not(.md-fab) {
min-width: 10em;
}
如您所见,它会为按钮添加最小宽度,只要它们不是 .md-fab
。
最终,您只需向 CSS 添加一些内容即可为按钮元素设置 min-width
。
像这样的基本内容:
.md-button {
min-width: 10em;
font-weight: 500;
}
这取决于你想用在哪里。如果您在任何列表项中使用,则
<md-button layout-fill>Post Requirement</md-button>
或者您可以使用
<md-button style="width:200px;">Post Requirement</md-button>
我有这个问题,那是因为我(愚蠢地)忘记包含 'Roboto' 字体。
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
您需要在页面上包含这样的内容,粗体按钮可能只需要 500。
我正在使用 AngularJS 和 Material 设计,但困扰我的一件事是我无法完全重现 google 官方使用的样式按钮标签的网站。 Material Deisgn Button Demo
当我使用这样的按钮时:
<md-button class="md-raised md-primary">Start</md-button>
<md-button class="md-raised md-primary"><label>Start</label></md-button>
我得到这样的结果:
我期待有这样的东西:
这与我根据他们网站上提供的源代码编写的代码有点相同
<md-button class="md-raised md-primary">Primary</md-button>
我试过使用 <b></b>
标签而不是标签,但结果是相似的,有些字母不太合适...我是否缺少解决此字体问题的方法?
编辑:我的代码之一的示例。
(function() {
angular
.module("demoApp", [
"ngMaterial",
"app.config",
"app.controller"
]);
})();
.md-button {
min-width: 10em;
}
<!doctype HTML>
<html>
<head>
<link rel="stylesheet" href="../bootstrap/bootstrap.css">
<link rel="stylesheet" href="../material/angular-material.css">
<link rel="stylesheet" href="style/style.css">
</head>
<body ng-app="demoApp">
<div layout="column" style="padding-bottom: 20px;">
<md-toolbar layout="row">
<h1 class="Title">Ten plus ten is {{10+10}}!</h1>
</md-toolbar>
</div>
<div layout="row">
<div>
</div>
<div layout="column">
<div layout="row">
<div flex="25" flex-sm="0" flex-md="0"></div>
<div flex class="md-whiteframe-z1" layout="column" style="margin-bottom: 15px;">
<md-toolbar class="md-primary">
<div class="md-toolbar-tools">
<span class="md-flex">Parameters</span>
</div>
</md-toolbar>
<md-content class="md-padding">
<p>Lorem ipsum dolor sit amet, ne quod novum mei. Sea omnium invenire mediocrem at, in lobortis conclusionemque nam. Ne deleniti appetere reprimique pro, inani labitur disputationi te sed. At vix sale omnesque, id pro labitur reformidans accommodare,
cum labores honestatis eu. Nec quem lucilius in, eam praesent reformidans no. Sed laudem aliquam ne.
</p>
<p>
Facete delenit argumentum cum at. Pro rebum nostrum contentiones ad. Mel exerci tritani maiorum at, mea te audire phaedrum, mel et nibh aliquam. Malis causae equidem vel eu. Noster melius vis ea, duis alterum oporteat ea sea. Per cu vide munere fierent.
</p>
<div>
<div layout="column" ng-controller="ParametersController as params">
<md-content class="md-padding">
<div layout layout-sm="column">
<md-input-container flex>
<label>Parameter 1</label>
<input ng-model="params.param1" placeholder="placehold text">
</md-input-container>
<md-input-container flex>
<label>Parameter 2</label>
<input ng-model="params.param2" placeholder="placehold text">
</md-input-container>
</div>
<div layout layout-sm="column">
<md-input-container flex>
<label>Parameter 3</label>
<input ng-model="params.param3" placeholder="placehold text">
</md-input-container>
<md-input-container flex>
<label>Parameter 4</label>
<input ng-model="params.param4" placeholder="placehold text">
</md-input-container>
</div>
</md-content>
</div>
<div layout="row" layout-align="end center">
<div></div>
<md-button class="md-raised md-primary" ng-click="sendParameters()">Primary</md-button>
</div>
</div>
</md-content>
</div>
<div flex="25" flex-sm="0" flex-md="0"></div>
</div>
<div layout="row">
<div flex="25" flex-sm="0" flex-md="0"></div>
<div flex class="md-whiteframe-z1" layout="column" style="margin-bottom: 15px;">
<md-toolbar class="md-primary">
<div class="md-toolbar-tools">
<span class="md-flex">Algorithm</span>
</div>
</md-toolbar>
<md-content class="md-padding">
<p>Lorem ipsum dolor sit amet, ne quod novum mei. Sea omnium invenire mediocrem at, in lobortis conclusionemque nam. Ne deleniti appetere reprimique pro, inani labitur disputationi te sed. At vix sale omnesque, id pro labitur reformidans accommodare,
cum labores honestatis eu. Nec quem lucilius in, eam praesent reformidans no. Sed laudem aliquam ne.
</p>
<p>
Facete delenit argumentum cum at. Pro rebum nostrum contentiones ad. Mel exerci tritani maiorum at, mea te audire phaedrum, mel et nibh aliquam. Malis causae equidem vel eu. Noster melius vis ea, duis alterum oporteat ea sea. Per cu vide munere fierent.
</p>
</md-content>
</div>
<div flex="25" flex-sm="0" flex-md="0"></div>
</div>
<div layout="row">
<div flex="25" flex-sm="0" flex-md="0"></div>
<div flex class="md-whiteframe-z1" layout="column" style="margin-bottom: 15px;">
<md-toolbar class="md-accent">
<div class="md-toolbar-tools">
<span class="md-flex">Video</span>
</div>
</md-toolbar>
<md-content class="md-padding">
<p>Lorem ipsum dolor sit amet, ne quod novum mei. Sea omnium invenire mediocrem at, in lobortis conclusionemque nam. Ne deleniti appetere reprimique pro, inani labitur disputationi te sed. At vix sale omnesque, id pro labitur reformidans accommodare,
cum labores honestatis eu. Nec quem lucilius in, eam praesent reformidans no. Sed laudem aliquam ne.
</p>
<p>
Facete delenit argumentum cum at. Pro rebum nostrum contentiones ad. Mel exerci tritani maiorum at, mea te audire phaedrum, mel et nibh aliquam. Malis causae equidem vel eu. Noster melius vis ea, duis alterum oporteat ea sea. Per cu vide munere fierent.
</p>
</md-content>
</div>
<div flex="25" flex-sm="0" flex-md="0"></div>
</div>
</div>
</div>
<!-- Angular Material Dependencies -->
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-animate.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-route.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.6/angular-aria.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/angular_material/0.7.1/angular-material.min.js"></script>
<script src="app.module.js"></script>
<script src="app.config.js"></script>
<script src="app.contoller.js"></script>
</body>
</html>
在您链接到的演示页面上,它还在外部样式表之外的页面上添加了一些样式。
此样式为:
.buttondemoBasicUsage section .md-button:not(.md-fab) {
min-width: 10em;
}
如您所见,它会为按钮添加最小宽度,只要它们不是 .md-fab
。
最终,您只需向 CSS 添加一些内容即可为按钮元素设置 min-width
。
像这样的基本内容:
.md-button {
min-width: 10em;
font-weight: 500;
}
这取决于你想用在哪里。如果您在任何列表项中使用,则
<md-button layout-fill>Post Requirement</md-button>
或者您可以使用
<md-button style="width:200px;">Post Requirement</md-button>
我有这个问题,那是因为我(愚蠢地)忘记包含 'Roboto' 字体。
<link href='https://fonts.googleapis.com/css?family=Roboto:400,300,300italic,400italic,500,500italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
您需要在页面上包含这样的内容,粗体按钮可能只需要 500。