需要巧妙的想法:如何为不同的字体声明不同的大小? @字体面? [英] ingenious idea needed: how to declare different sizes for different fonts? @font-face?
本文介绍了需要巧妙的想法:如何为不同的字体声明不同的大小? @字体面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从来没有见过这样做,但我觉得有一个聪明的做法。
它从来没有被认为是,但是当我环顾我看到一些非常巧妙的css技术正在进行。以这个上NETTUTS昨天使用@ font-face作为矢量图标。
我的挑战(注意2种不同的字体大小):
if(user has calibri){font-family:calibri; font-size:12px; }
if(user has not calibri){font-family:arial; font-size:10px; }
解决方案
$ b
这是我能想到的最好的,但id喜欢避免真正的js ....
< p id =font-teststyle =font-family:calibri,arial; display:inline-block;> MMMMM< / p>
< script>
var width = $('#font_test')。attr('width');
if(width> x){
var has_calibri = false;
}
else {
var has_calibri = true;
}
< / script>
I've never seen this done, but i get a feeling that there's gotta be a clever way of doing it.
css font-size-adjust looks like it was never meant to be, but when i look around I'm seeing some really ingenious css techniques going on.
Take this on nettuts yesterday for using @font-face for vector icons.
my challenge (notice the 2 different font sizes):
if(user has calibri ) { font-family: calibri; font-size: 12px; }
if(user hasn't calibri ) { font-family: arial; font-size: 10px; }
解决方案
could this work?
it's the best i can think of, but id like to avoid js really....
<p id="font-test" style="font-family: calibri, arial; display:inline-block;">MMMMM</p>
<script>
var width = $('#font_test').attr('width');
if( width > x ){
var has_calibri = false;
}
else{
var has_calibri = true;
}
</script>
这篇关于需要巧妙的想法:如何为不同的字体声明不同的大小? @字体面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文