简体   繁体   English

如何在Lightbox中更改字幕字体?

[英]How to change the caption font of in Lightbox?

I am using jQuery developed about lightboxes , and it is amazing. 我正在使用有关灯箱开发的jQuery,这真是太神奇了。 However, I saw that the font of the captions and it don't fit to my website style... I wanted to know if someone had an idea about how to change the webfont of this captions... 但是,我发现字幕的字体不适合我的网站样式...我想知道是否有人对如何更改此字幕的webfont有想法...

Font is changed by targeting the parent div and child element class or attribute and then specifying the font family. 通过定位父div和子元素类或属性,然后指定字体系列,可以更改字体。

eg 例如

<div class="light-box-sample">
    <p>  this could be a text</p>
</div>

Your CSS should look like 您的CSS应该看起来像

.light-box-sample p {
   font-family: 'open sans' sans-serif;
}

Note : targeting .light-box-sample wont do the magic, the child element should be targeted also. 注意:定位.light-box-sample不会发挥作用,子元素也应定位。

if there was no child element then the parent div could be targeted. 如果没有子元素,则可以将父div作为目标。

in the above CSS the first font indicates the universal font, and the double quote is used when the font has a space between its name literally like your first font choice , second font indicates a backup font that's located on all PC. 在上面的CSS中,第一种字体表示通用字体,当字体名称之间的空格与第一种字体一样时,双引号将被使用,第二种字体表示所有PC上的备用字体。

Generally you need to first download your font, and install locally on your PC to see the effect on your development environment and when you are done changing what you want to , you could add the CDN link of the font to the head section or whatever way to your design, so users who doesn't have that font installed on there computer could also see the font manifest. 通常,您需要首先下载字体,然后在本地安装在PC上以查看对开发环境的影响,当您完成所需的更改后,可以将字体的CDN链接添加到开头部分,或采用其他方式根据您的设计,因此在该计算机上未安装该字体的用户也可以看到字体清单。

hope this was helpful :-) 希望这对您有所帮助:-)

Enter code into lightbox.min.css to change caption font attributes: 在lightbox.min.css中输入代码以更改字幕字体属性:

.lb-caption {
font-size: 24px !important;
color: #727fee !important;
font-family: helvetica !important;
}

.lb-number {
color: red !important;
}

(.lb-number will change page number attributes) (.lb-number将更改页码属性)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM