html - chrome 不尊重字体系列 ('PT Sans' )

标签 html css google-chrome fonts styles

我有一个用 HTML 编写的网页,其中我有一个 button 。所有页面均尊重font-family: 'PT Sans', sans-serif除了我的按钮。

body {
  font-family: 'PT Sans', sans-serif;
  margin: 0px 0px 0px 0px;
}   

这是表格内的按钮元素:

<button id="createCampaignButton" class="yellowButton" nowrap>CREATE NEW CAMPAIGN</button>

我还使用过<style>像下面这样的标签,它会改变字体颜色,但不会改变字体系列。

button {
          font-family: 'PT Sans', sans-serif;
          color: red
       }

我在这里搜索过,但没有一个适合我。

我的样式表:

<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'>

.yellowButton {
border: 0 solid #FFCC00;
width:100%;
/*height: 50px;*/
font-size: 16px; 
font-weight: bold;
background-color: #FFCC00; 
padding: 12px 20px;
box-shadow: 0 2px 2px 0 #C2C2C2;
border-radius: 2px;
outline:none;
}
.yellowButton:active {
  border: 0 solid #FFCC00;
  width:100%;
  /*height: 50px;*/
  font-size: 16px; 
  font-weight: bold;
  background-color: #FFCC00; 
  padding: 12px 20px;
  box-shadow: 0 0 0 0 #C2C2C2;
  border-radius: 2px;
  outline: none;
}

更新 现在我注意到问题只出在 'PT Sans' 上。字体!所有其他字体都工作正常。

最佳答案

你有包含这个文件吗?

<link href='https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic' rel='stylesheet' type='text/css'>

如果不只是在标题中过去。

或者如果你想在CSS中,使用这个

@import url(https://fonts.googleapis.com/css?family=PT+Sans:400,400italic,700,700italic);

关于html - chrome 不尊重字体系列 ('PT Sans' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37833531/

相关文章:

javascript - 超链接输出中显示的 HTML 标记

jquery - 如何访问显示为 none 的元素并更改其 css 属性

php - 自动转换 CSS 文件以用于深色背景

css - float div 背景颜色直到页面结束才到达

php - 桌面网站上的汉堡包菜单(带有小尺寸图标),用于切换单击时的全宽和高度下拉菜单(Bootstrap 4)

python - 连接重置错误: [WinError 10054] An existing connection was forcibly closed by the remote host error with ChromeDriver Chrome Selenium Django

google-chrome - 控制 “Oops! Chrome could not find … ”页面?

javascript - 我无法使用动态路径名将文件路径中的图像附加到动态创建的 div 中

jquery - 在每个 <td> 上添加 <th> 文本 - jquery

javascript - 谷歌浏览器 - 使用 ajax 时停滞不前,如何解决?