Fonts 我可以上传自定义字体到大卡特尔吗

Fonts 我可以上传自定义字体到大卡特尔吗,fonts,bigcartel,custom,Fonts,Bigcartel,Custom,我有一个特定的字体,我在我的名片上使用,为了一致性,我想在我的网站上使用它们。我没有找到上传字体的方法,在自定义菜单中找不到。非常感谢您的帮助 是的,您可以使用CSS中的@fontface功能上载自定义字体,但您需要访问服务器才能从中存储和上载。我使用了Luna主题,效果很好: 将此代码插入CSS文件,并将URL替换为字体的正确位置: @font-face { font-family: CustomFontName; src: url(http://yourserver.com/

我有一个特定的字体,我在我的名片上使用,为了一致性,我想在我的网站上使用它们。我没有找到上传字体的方法,在自定义菜单中找不到。非常感谢您的帮助

是的,您可以使用CSS中的@fontface功能上载自定义字体,但您需要访问服务器才能从中存储和上载。我使用了Luna主题,效果很好:

将此代码插入CSS文件,并将URL替换为字体的正确位置:

@font-face {
    font-family: CustomFontName;
    src: url(http://yourserver.com/fonts/customfontname.ttf); 
}
我选择把我的放在我主题的“元素/共享”部分,从CSS文件的开头往下一点

然后更改CSS的此部分:

/* Body Font */
body,
.product_header h3,
.product_header h5,
#product_inventory li h5,
#cart_items li .item_option,
#cart_summary li h3,
#social_links li h4,
.standalone .canvas p
{ font-family: {{ theme.body_font | font_family }}; }


/* Header Font */
h1, h2, h3, h4, h5, h6,
.button,
#error li,
#site_footer ul,
#site_footer #search input,
#main_nav li,
#cart_items li dt,
#cart_items li dd,
#cart_options #cart_discount p,
#cart_summary li span,
.standalone .canvas h1, input,
#cart_items li .quantity_input input
{ font-family: {{ theme.header_font | font_family }}; }
为此:

/* Body Font */
body,
.product_header h3,
.product_header h5,
#product_inventory li h5,
#cart_items li .item_option,
#cart_summary li h3,
#social_links li h4,
.standalone .canvas p
{ font-family: CustomFontName; }


/* Header Font */
h1, h2, h3, h4, h5, h6,
.button,
#error li,
#site_footer ul,
#site_footer #search input,
#main_nav li,
#cart_items li dt,
#cart_items li dd,
#cart_options #cart_discount p,
#cart_summary li span,
.standalone .canvas h1, input,
#cart_items li .quantity_input input
{ font-family:CustomFontName; }
你应该准备好了,字体会在你的主题中改变。这只在Luna主题上进行了测试,但我认为这应该在所有主题中都适用


要跨浏览器执行此操作,您需要访问承载字体的服务器上的.htaccess文件,并添加以下行:

Header set Access-Control-Allow-Origin "*"

这里的文档:

您测试过这个跨浏览器吗?对我来说,它似乎只在Safari上起作用,因为我在其他浏览器上遇到了一个错误:跨源请求被阻止:同一源策略不允许读取远程资源。(原因:缺少CORS标头“访问控制允许原点”)。