在CSS中识别父类时,BigText插件不起作用 [英] BigText Plugin not working when parent class is identified in css

查看:57
本文介绍了在CSS中识别父类时,BigText插件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用以下jquery插件根据容器div的宽度设置字体大小:

I've been using the following jquery plugin to set my font sizes based on the width of the container divs: http://www.zachleat.com/web/bigtext-makes-text-big/ I have been able to get it working with different fonts when I define the fonts in the css as

.bigtext{
    font-family:Arial
}

请参见 http://jsfiddle.net/pF5bQ/3/

但是,如果我用父类定义css

however, if I define the css with a parent class

.theme .bigtext{
    font-family:Arial
}

它设置字体太大.

请参见 http://jsfiddle.net/pF5bQ/4/

我正在开发的应用程序具有使用不同字体的各种主题,因此我需要能够基于父类为bigtext定义不同的样式.

The app I'm working on features various themes that use different fonts so I need to be able to define different styles for the bigtext based on the parent class.

有什么想法吗?

推荐答案

不是一个真正的"解决方案,但最终发现的工作是,如果我将主题类应用于与大文本相同的div,我将d得到理想的结果.

Not a 'true' solution but the work around I ended up discovering was that if I applied my theme class to the same div as the big text, I'd get the desired result.

.theme.bigtext{
    font-family:Arial
}

感觉真的很hacky,因为在我正在处理的项目中,我需要进行类切换,而不需要使用javascript,但这可以完成工作.

It feels really hack-y because in the project I'm working on, I need to do the class switching and what not in javascript, but it gets the job done.

http://jsfiddle.net/pF5bQ/7/

这篇关于在CSS中识别父类时,BigText插件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆