首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >tpl文件中的Font-family

tpl文件中的Font-family
EN

Stack Overflow用户
提问于 2015-11-30 05:07:54
回答 2查看 317关注 0票数 2

我正在尝试从.tpl文件中更改包含在div中的UL中的字体系列。代码如下:

代码语言:javascript
复制
<div id="header" class="floatleft desktop_view ">
  {if !$checkoutPage}
        <div id="header_menu" >
            <ul>
                <li>{a module=MainPage}<img src="{url href='images/homepage.png'}" alt="Homepage" title="Home livrare flori Timisoara" />{/a}</li>
                <li>{a module=Frontend action=productsListPromotions}Promotii{/a}</li>
                <li><a rel="nofollow" href="{url module=Cms action=pageView page_id=10 seo_page_seo_title="livrare-si-plata"}"> Livrare si plata</a></li>
                {if !$mainPageDefaultAction}
                    <li><a rel="nofollow" href="http://blog.livrarefloritm.ro/"> Blog </a></li>
                {/if}
                <li class="last">{a module=Frontend action=static_contact}Contact{/a}</li>
            </ul>
            <div class="clearboth"></div>
        </div>

这是css。我不得不提一下,字体文件和css文件在同一个文件夹中。

代码语言:javascript
复制
#header_menu li{font-family: 'crescentregular';}
#header #header_menu {{font-family: 'crescentregular';display: block;position: absolute;right: 0;top: 0; z-index: 100;}
#header #header_menu ul li{ {font-family: 'crescentregular';border-right: 1px solid; float: left; margin-right: 10px; padding-right: 10px; height: 20px; line-height: 20px;}
#header #header_menu ul li.last{ border-right: none;}

问题是,这是行不通的。

EN

回答 2

Stack Overflow用户

发布于 2015-11-30 05:38:52

如果您正在尝试使用自定义字体,则需要向您的css添加@font-face声明,例如:

代码语言:javascript
复制
@font-face {
  font-family: 'crescentregular';
  src: url('crescentregular.eot'); /* IE9 Compat Modes */
  src: url('crescentregular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('crescentregular.woff2') format('woff2'), /* Super Modern Browsers */
       url('crescentregular.woff') format('woff'), /* Pretty Modern Browsers */
       url('crescentregular.ttf')  format('truetype'), /* Safari, Android, iOS */
       url('crescentregular.svg#crescentregular') format('svg'); /* Legacy iOS */
}

只需将示例缩减为您已有的字体文件,您就应该没问题了。

希望这能有所帮助

票数 0
EN

Stack Overflow用户

发布于 2015-11-30 06:15:03

您在CSS中使用了双{。试试这个:

代码语言:javascript
复制
#header_menu li {font-family: 'crescentregular';}
#header #header_menu {font-family: 'crescentregular';display: block;position: absolute;right: 0;top: 0; z-index: 100;}
#header #header_menu ul li {font-family: 'crescentregular';border-right: 1px solid; float: left; margin-right: 10px; padding-right: 10px; height: 20px; line-height: 20px;}
#header #header_menu ul li.last{ border-right: none;}

某些浏览器可能会遇到{{问题并忽略该规则。

希望这能有所帮助

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33988140

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档