【问题标题】:Safari rendering Google Font massiveSafari 渲染谷歌字体海量
【发布时间】:2013-01-16 05:37:08
【问题描述】:

您好,我的导航菜单有问题,它通过 Google 字体使用指向 Yanone Kaffeesatz 的链接并使用 26pt 和小型大写字母 - 在 IE/FF 和 Chrome 中看起来不错,但刚刚检查了 Safari 和 Iphone 以及字体 -尺寸相当大 - 以至于菜单添加了第二行

我认为 Safari 上的默认字体大小没有问题,因为其他字体看起来与其他浏览器相同。

这是CSS,任何帮助将不胜感激

* {margin: 0; padding: 0;}
ul {list-style: none;}
a {color: black; text-decoration: none; padding-bottom: 3px;}
a:visited {color: black;}

body {
    width: 100%;
    font-size: 100%;
    background-color: #bab89b;
    background-image:url('http://xxx/assets/background.jpg');
    font-family: HelveticaNeue-Light, Helvetica Neue, Arial, sans-serif;

}

container {
    width: 900px;
    margin: 0 auto;
}

#header {
    width: 900px;
    text-align: center;
    margin: 0 auto;
}

#photo {
    float: left;
    margin-left: 80px;
    margin-right: 80px;
    margin-top: 30px;
}

#photo img {
    padding: 10px;
    background-color: #eee;
    border: 2px solid #ccc;
    rotation: 90deg;
    -webkit-transform: rotate(-10deg) scale(0.9);
    -moz-transform: rotate(-10deg) scale(0.9);
    -webkit-transition: all 0.4s ease-in-out;
    -moz-transition: all 0.4s ease-in-out;

}       

#photo img:hover {
    -webkit-transform: rotate(10deg) scale(1.1);
    -moz-transform: rotate(10deg) scale(1.1);
}

#titles {float: left;}

#header h1 {
    font-family: Helvetica Neue, Arial, sans-serif;
    font-size: 56pt;
    font-weight: 100;
    margin-top: 30px;

}

#header h2 {
    font-family: HelveticaNeue-Light, Helvetica Neue, Arial, sans-serif;
    font-style: italic;
    font-weight: 300;
    font-size: 20pt;
}

/* NAVIGATION */

#navWrap {
    width: 900px;
    height: 3em;
    margin: 0 auto;
    margin-top: 30px;
    padding-top: 1em;
    padding-bottom: 1em;
    border-top: 1px solid black;
    border-bottom: 1px solid black;
    text-align: center;
}

#nav {
    width: 900px;
}

#nav li {
    display: inline;
    line-height: 3em;
    padding: 0 20px;
}

#nav li a {
    font-family: Yanone Kaffeesatz, sans-serif;
    color: black;
    font-variant: small-caps;
    font-size: 26pt;
    margin-right: 40px;
    text-decoration: none;
}


#nav li a:hover {border-bottom: 4px solid black;}
#nav li a.current:hover {border-bottom: none;}

/* CONTENT */

#content {
    width: 900px;
    margin: 0 auto;
    text-align: center;
}

#contentHeader {
    width: 900px;
    margin: 0 auto;
    margin-top: 40px;
    margin-bottom: 20px;
    text-align: center;
}

#contentHeader h2 {
    font-family: Helvetica Neue; Arial, sans-serif;
    font-size: 24pt;
    font-weight: 100;
}


/* SUBJECTS PAGE */


#box1, #box2, #box3 {
    width: 900px;
    margin: 0 auto;
    margin-bottom: 50px;
    font-family: Helvetica Neue, Arial, sans-serif;
    font-weight: 100;
}


.clearer {
    clear: both;

}

.leftContent {
    float: left;
    width: 480px;
    height: 240px;
    padding: 40px;
    border: 1px solid #e7e7e7;
    background-color: #e7e7e7;
    -moz-border-radius: 10px;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    margin-bottom: 30px;

}

.leftContent h3 {
    font-size: 22pt;
    font-weight: 100;
    margin-bottom: 20px;
}

.leftContent h4 {
    font-size: 18pt;
    font-weight: 100;
    margin-bottom: 20px;
}


.leftContent p {
    font-family: HelveticaNeue-Light, Helvetica Neue, Arial, sans-serif;
    font-size: 11pt;
    line-height: 1.5em;
    font-weight: 300;
}

.rightContent {
    float: right;
    width: 200px;
    height: 120px;
    vertical-align: middle;
    padding: 40px;
    margin-top: 60px;
    margin-bottom: 30px;
    font-style: italic;
}

.rightContent h3 {
    font-size: 16pt;
    font-weight: 100;
    margin-bottom: 15px;
}

.rightContent li {
    font-size: 11pt;
    font-weight: 100;
    line-height: 1.5em;
}



/* FEEDBACK */

.bubbleText {
    width: 550px;
    margin: 30px auto 5px auto;
    border: 1px solid #ccc;
    background-color: #e7e7e7;
    -moz-border-radius: 15px;
    -webkit-border-radius: 15px;
    border-radius: 15px;
    padding: 20px 30px;
    font-family: HelveticaNeue-Light, Helvetica Neue, Arial, sans-serif;
    font-size: 10pt;
    font-weight: 300;
}


.bubbleDesc {
    margin-bottom: 
}

#showMoreLink, #showLessLink {
    margin-top: 40px;
    font-size: 24pt;
    font-style: italic;
    font-variant: small-caps;
    cursor: pointer;
}

#showMoreLink:hover, #showLessLink:hover {
    text-decoration: underline;
}

#moreText {
    display: none;
}

/* BIO */

#leftBioBlock {
    float: left;
    width: 400px;
    margin-right: 60px;
    margin-left: 20px;
}

#rightBioBlock {
    float: left;
    width: 400px;
}

.bioTextBlock {
    font-family: 'Yanone Kaffeesatz', sans-serif;
    width: 350px;
    height: 300px;
    margin: 0 auto 50px auto;
    padding:30px;
    border: 1px solid #e7e7e7;
    background-color: #e7e7e7;
    -webkit-border-radius: 15px; 
    -moz-border-radius: 15px; 
    border-radius: 15px;
    position: relative;
}

.bioTextBlockCenter {
    font-family: 'Yanone Kaffeesatz', sans-serif;
    width: 400px;
    height: 300px;
    margin: 0 auto;
    padding:30px;
    border: 1px solid #e7e7e7;
    background-color: #e7e7e7;
    -webkit-border-radius: 15px; 
    -moz-border-radius: 15px; 
    border-radius: 15px;

}

.bioTextBlockCenter:hover 

.bioTextBlock, .bioTextBlockCenter{
    -moz-box-shadow: 5px 5px 3px #888;
    -webkit-box-shadow: 5px 5px 3px #888;
    box-shadow: 5px 5px 3px #888;
}

.bioTextHead {
    font-size: 28pt;
    margin-bottom: 20px;
}

.bioTextBlock p, bioTextBlock li, .bioList  {
    font-family: Helvetica Neue, Arial, Sans-serif;
    font-weight: 300;
    font-size: 11pt;
    line-height: 1.4em;
}

.bioList li {
    line-height: 2em;
}

#CVlink {
    position: absolute;
    left: 85px;
    bottom: 30px;
    text-align: center;
    font-family: Helvetica Neue, Arial, sans-serif;
    font-size: 18pt;
    font-weight: 100;
    -webkit-transition: color 0.4s linear;
    -moz-transition: color 0.4s linear;
}

#CVlink:hover {
    color: #ce984e;
}

/* FORM */


form {
    width: 900px;
    margin: 0 auto;
    padding: 40px;

}

legend {
    font-family: HelveticaNeue-Light, Helvetica Neue, Arial, sans-serif;
    font-size: 18pt;
    padding-bottom: 15px;
    font-weight: 100;
}

label { 
     font-family: 'Yanone Kaffeesatz', sans-serif;
     font-size: 16pt;
     display: block;
}

input, select { 
    width: 250px;
    height: 1.5em;
    font-family: HelveticaNeue-Light, Helvetica Neue, Arial, sans-serif;
    font-size: 12pt;
    color: #575754;
    margin-bottom: 15px;
}


fieldset#formCol1 {
    width: 300px;
    padding: 25px;
    display: inline;
    margin-right: 80px;
    margin-left: 60px;
    vertical-align:top;
}

fieldset#formCol2{
    width: 300px;
    padding: 25px;
    padding-bottom: 37px;
    display: inline;
    vertical-align: top;
}


fieldset#formCol3 {
    clear: both;
    width: 740px;
    margin: 30px auto 0 60px;
    text-align: center;
    padding: 25px;
}

select {
    margin-bottom: 15px;
}

#sendButton {
    width: 80px;
}

textarea {
    width: 450px;
    height: 150px;
    padding: 5px;
    font-family: HelveticaNeue-Light, Helvetica Neue, Arial, sans-serif;
    font-size: 11pt;
}

placeholder {
    font-size: 11pt;
    font-style: italic;
}



#denotes {
    text-align: center;
    margin-top: -20px;
    margin-bottom: -20px;
    font-weight: 100;
}

/* HIDDEN SPAM TRAP BOX */

input.random {display: none;}


/* FOOTER */

#footer {
    width: 900px;
    margin: 100px auto 0 auto;
    text-align: center;
    padding-top: 60px;
    padding-bottom: 20px;
    border-top: 1px dashed #666;
}

#footerCopy {
    font-family: HelveticaNeue-Light, Helvetica Neue, Arial, sans-serif;
    font-size: 10pt;
    font-weight: 100;
    text-align: center;
}

.siteLink {
    text-align: center;
    font-family: Helvetica Neue, Arial, sans-serif;
    font-size: 28pt;
    font-weight: 100;
    -webkit-transition: color 0.8s linear;
    -moz-transition: color 0.8s linear;
}

.siteLink:hover {color: #ce984e; border-bottom: none;}

#profTutor {
    text-align: center;
    font-family: Helvetica Neue, Arial, sans-serif;
    font-size: 14pt;
    font-weight: 100;
    font-variant: small-caps;
    margin-bottom: 20px;
}

/* IPHONE RULES */
@media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) {


    div#rightContent1, div#rightContent2, div#rightContent3 {
        display: block;
    }


}

【问题讨论】:

    标签: html css fonts safari font-face


    【解决方案1】:

    使用 26 像素,而不是 26 磅。点用于打印,而不是屏幕显示,并且在每个浏览器中看起来都不同。

    【讨论】:

    • 好的,谢谢,我一直认为 pt 是用于字体的。仔细观察,似乎其他浏览器显示的 Yanone 字体更简洁,而 Safari 则更宽。你以前见过这个吗?谢谢
    • 进一步环顾四周后,我发现此链接 [link] (stackoverflow.com/questions/2014392/…) 似乎表明字体变体和导入字体在 safari 中存在问题。当我删除 font-variant 时一切都正常了,但不幸的是没有想要的效果
    • 我从来没有遇到过 Safari 字体显示的问题;通常很好。不过那里可能有一个错误,因为 font-variant 并不是一个常用的属性并且是一个 CSS3 属性,我敢打赌它还没有完全支持。但这只是一个猜测,所以不要打电话给我;)。
    【解决方案2】:

    将此添加到您的身体中

    显示:0.99;

    所以整个css将是

    * {边距:0;填充:0;} ul {列表样式:无;} 一个{颜色:黑色;文字装饰:无; padding-bottom: 3px;} 一个:访问{颜色:黑色;} 身体 { 宽度:100%; 字体大小:100%; 背景颜色:#bab89b; 背景图片:url('http://xxx/assets/background.jpg'); 字体家族:HelveticaNeue-Light、Helvetica Neue、Arial、sans-serif; 显示:0.99; } 容器 { 宽度:900px; 边距:0 自动; } #标题{ 宽度:900px; 文本对齐:居中; 边距:0 自动; } #照片 { 向左飘浮; 左边距:80px; 右边距:80px; 边距顶部:30px; } #照片图片{ 填充:10px; 背景颜色:#eee; 边框:2px 实心#ccc; 旋转:90度; -webkit-transform:旋转(-10度)比例(0.9); -moz 变换:旋转(-10 度)比例(0.9); -webkit-transition:所有 0.4s 缓入出局; -moz-transition:所有 0.4s 缓入出局; } #照片图像:悬停{ -webkit-transform:旋转(10度)比例(1.1); -moz 变换:旋转(10 度)比例(1.1); } #titles {浮动:左;} #标题h1 { 字体系列:Helvetica Neue、Arial、无衬线字体; 字体大小:56pt; 字体粗细:100; 边距顶部:30px; } #标题h2 { 字体家族:HelveticaNeue-Light、Helvetica Neue、Arial、sans-serif; 字体样式:斜体; 字体粗细:300; 字体大小:20pt; } /* 导航 */ #navWrap { 宽度:900px; 高度:3em; 边距:0 自动; 边距顶部:30px; 填充顶部:1em; 底部填充:1em; 边框顶部:1px 纯黑色; 边框底部:1px 纯黑色; 文本对齐:居中; } #导航{ 宽度:900px; } #nav李{ 显示:内联; 行高:3em; 填充:0 20px; } #nav里一个{ 字体系列:Yanone Kaffeesatz,无衬线; 颜色:黑色; 字体变体:小型大写; 字体大小:26pt; 边距右:40px; 文字装饰:无; } #nav li a:hover {border-bottom: 4px solid black;} #nav li a.current:hover {border-bottom: none;} /* 内容 */ #内容 { 宽度:900px; 边距:0 自动; 文本对齐:居中; } #contentHeader { 宽度:900px; 边距:0 自动; 边距顶部:40px; 边距底部:20px; 文本对齐:居中; } #contentHeader h2 { 字体系列:Helvetica Neue;宋体,无衬线; 字体大小:24pt; 字体粗细:100; } /* 主题页面 */ #box1,#box2,#box3 { 宽度:900px; 边距:0 自动; 边距底部:50px; 字体系列:Helvetica Neue、Arial、无衬线字体; 字体粗细:100; } . 更清晰 { 明确:两者; } .leftContent { 向左飘浮; 宽度:480px; 高度:240px; 内边距:40px; 边框:1px 实心#e7e7e7; 背景颜色:#e7e7e7; -moz-边界半径:10px; -webkit-border-radius:10px; 边框半径:10px; 边距底部:30px; } .leftContent h3 { 字体大小:22pt; 字体粗细:100; 边距底部:20px; } .leftContent h4 { 字体大小:18pt; 字体粗细:100; 边距底部:20px; } .left 内容 p { 字体家族:HelveticaNeue-Light、Helvetica Neue、Arial、sans-serif; 字体大小:11pt; 行高:1.5em; 字体粗细:300; } .rightContent { 浮动:对; 宽度:200px; 高度:120px; 垂直对齐:中间; 内边距:40px; 边距顶部:60px; 边距底部:30px; 字体样式:斜体; } .rightContent h3 { 字体大小:16pt; 字体粗细:100; 底部边距:15px; } .rightContent li { 字体大小:11pt; 字体粗细:100; 行高:1.5em; } /* 反馈 */ .bubbleText { 宽度:550 像素; 边距:30px 自动 5px 自动; 边框:1px 实心#ccc; 背景颜色:#e7e7e7; -moz-边界半径:15px; -webkit-border-radius:15px; 边框半径:15px; 填充:20px 30px; 字体家族:HelveticaNeue-Light、Helvetica Neue、Arial、sans-serif; 字体大小:10pt; 字体粗细:300; } .bubbleDesc { 边距底部: } #showMoreLink,#showLessLink { 边距顶部:40px; 字体大小:24pt; 字体样式:斜体; 字体变体:小型大写; 光标:指针; } #showMoreLink:悬停,#showLessLink:悬停{ 文字装饰:下划线; } #moreText { 显示:无; } /* 生物 */ #leftBioBlock { 向左飘浮; 宽度:400px; 右边距:60px; 左边距:20px; } #rightBioBlock { 向左飘浮; 宽度:400px; } .bioTextBlock { 字体系列:'Yanone Kaffeesatz',无衬线; 宽度:350 像素; 高度:300px; 边距:0 自动 50 像素自动; 填充:30px; 边框:1px 实心#e7e7e7; 背景颜色:#e7e7e7; -webkit-border-radius:15px; -moz-边界半径:15px; 边框半径:15px; 位置:相对; } .bioTextBlockCenter { 字体系列:'Yanone Kaffeesatz',无衬线; 宽度:400px; 高度:300px; 边距:0 自动; 填充:30px; 边框:1px 实心#e7e7e7; 背景颜色:#e7e7e7; -webkit-border-radius:15px; -moz-边界半径:15px; 边框半径:15px; } .bioTextBlockCenter:悬停 .bioTextBlock, .bioTextBlockCenter{ -moz-box-shadow: 5px 5px 3px #888; -webkit-box-shadow: 5px 5px 3px #888; 盒子阴影:5px 5px 3px #888; } .bioTextHead { 字体大小:28pt; 边距底部:20px; } .bioTextBlock p, bioTextBlock li, .bioList { 字体系列:Helvetica Neue、Arial、Sans-serif; 字体粗细:300; 字体大小:11pt; 行高:1.4em; } .bioList 李{ 行高:2em; } #CVlink { 位置:绝对; 左:85px; 底部:30px; 文本对齐:居中; 字体系列:Helvetica Neue、Arial、无衬线字体; 字体大小:18pt; 字体粗细:100; -webkit-transition:颜色 0.4s 线性; -moz-transition:颜色 0.4s 线性; } #CVlink:悬停{ 颜色:#ce984e; } /* 形式 */ 形式 { 宽度:900px; 边距:0 自动; 内边距:40px; } 传奇 { 字体家族:HelveticaNeue-Light、Helvetica Neue、Arial、sans-serif; 字体大小:18pt; 底部填充:15px; 字体粗细:100; } 标签 { 字体系列:'Yanone Kaffeesatz',无衬线; 字体大小:16pt; 显示:块; } 输入,选择{ 宽度:250px; 高度:1.5em; 字体家族:HelveticaNeue-Light、Helvetica Neue、Arial、sans-serif; 字体大小:12pt; 颜色:#575754; 底部边距:15px; } 字段集#formCol1 { 宽度:300px; 填充:25px; 显示:内联; 右边距:80px; 左边距:60px; 垂直对齐:顶部; } 字段集#formCol2{ 宽度:300px; 填充:25px; 底部填充:37px; 显示:内联; 垂直对齐:顶部; } 字段集#formCol3 { 明确:两者; 宽度:740px; 边距:30px 自动 0 60px; 文本对齐:居中; 填充:25px; } 选择 { 底部边距:15px; } #发送按钮 { 宽度:80px; } 文本区域 { 宽度:450px; 高度:150px; 填充:5px; 字体家族:HelveticaNeue-Light、Helvetica Neue、Arial、sans-serif; 字体大小:11pt; } 占位符 { 字体大小:11pt; 字体样式:斜体; } #表示{ 文本对齐:居中; 边距顶部:-20px; 边距底部:-20px; 字体粗细:100; } /* 隐藏的垃圾邮件陷阱箱 */ input.random {显示:无;} /* 页脚 */ #页脚{ 宽度:900px; 边距:100px 自动 0 自动; 文本对齐:居中; 填充顶部:60px; 底部填充:20px; 边框顶部:1px 虚线 #666; } #footerCopy { 字体家族:HelveticaNeue-Light、Helvetica Neue、Arial、sans-serif; 字体大小:10pt; 字体粗细:100; 文本对齐:居中; } .siteLink { 文本对齐:居中; 字体系列:Helvetica Neue、Arial、无衬线字体; 字体大小:28pt; 字体粗细:100; -webkit-transition:颜色 0.8s 线性; -moz-transition:颜色 0.8s 线性; } .siteLink:悬停{颜色:#ce984e;边框底部:无;} #profTutor { 文本对齐:居中; 字体系列:Helvetica Neue、Arial、无衬线字体; 字体大小:14pt; 字体粗细:100; 字体变体:小型大写; 边距底部:20px; } /* IPHONE 规则 */ @media screen and (max-device-width: 480px), screen and (-webkit-min-device-pixel-ratio: 2) { div#rightContent1,div#rightContent2,div#rightContent3 { 显示:块; } }

    【讨论】:

      猜你喜欢
      • 2013-06-28
      • 2011-11-18
      • 2015-10-25
      • 2017-02-01
      • 1970-01-01
      • 1970-01-01
      • 2016-04-22
      • 2016-10-30
      • 2021-10-18
      相关资源
      最近更新 更多