SwiftArchite..
64
在iOS和OS X上使用"font-family"CSS属性的"-apple-system"CSS值.
正如webkit.org上所述,目前在w3c中有关于标准化该值的讨论,因此作者可以简单地指定系统.
系统字体
iOS 9和Safari OS X 10.11上的-apple-system
使用font-family: CSS属性:
font-family: -apple-system;
font-family: '-apple-system','HelveticaNeue'; // iOS 8 compatible, credit: @MarcoBoschi
在上下文中(回退到HelveticaNeue时-apple-system未定义):
body{font-family: '-apple-system','HelveticaNeue'; font-size:17;}
重量和风格
使用font-weight: CSS属性:
normal, bold, bolder, lighter
100, 200, 300, 400, 500, 600, 700, 800, 900
使用font-style: CSS属性:
normal, italic
动态字体
iOS 8.4上的-apple-system-xxx.
使用font: CSS属性(代表整个样式,包括大小和重量):
font: -apple-system-body
font: -apple-system-headline
font: -apple-system-subheadline
font: -apple-system-caption1
font: -apple-system-caption2
font: -apple-system-footnote
font: -apple-system-short-body
font: -apple-system-short-headline
font: -apple-system-short-subheadline
font: -apple-system-short-caption1
font: -apple-system-short-footnote
font: -apple-system-tall-body
在上下文中:
body{font: -apple-system-body;}
使用`font-family:' - apple-system','HelveticaNeue';`.当`-apple-system`未定义时,这将选择`Helvetica`,而在iOS 9上选择`San Francisco`. (2认同)