等效于“字体大小+ 2”的HTML样式标签 [英] HTML Style tag equivalent of "font size+2"

查看:189
本文介绍了等效于“字体大小+ 2”的HTML样式标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是新的风格方式临时增加字体大小,然后返回正常(不使用CSS,或CSS是更好的方式?)。

What is the new "style" way of temporary increasing a font size, and then returning back to the normal (without using CSS, or is CSS the better way?).

我想在我的文本中插入希伯来语,对于初学者来说,希伯来字体太小了。我总是希望它比当前的字体大小,而不是钉住一些特定的大小。

I want to insert a Hebrew word in my text, and for beginners, the Hebrew font is just too small. I always want it bigger than the current font size, not pegged to some specific size.

下面的第1行工作(旧的做事方式)。
第2行的修复是什么?

Line 1 below works (the old way of doing things). What is the fix to line 2?

This is normal.  <font size="+2">bigger</font> back to norm. 
<span style='{FONT-SIZE: +2}'> and also bigger</span>.


推荐答案

我将创建一个类(让我们说.hebrew)并将font-size属性设置为1.2em。这样,无论周围文本的字体大小如何,希伯来语类的文本将会大20%。

I would create a class (let's say .hebrew) and set the font-size property to 1.2em. This way whatever the font size is of the surrounding text, the text with the class of hebrew will be 20% larger.

.hebrew {
    font-size: 1.2em;
}

这里是快速 demo jsFiddle 来说明(用绿色显示以帮助显示差异)。

Here's a quick demo jsFiddle to illustrate (colored with green to help show the difference).

评论,要在您的HTML中使用这个,您将添加类如下:

And as noted in the comments, to use this in your HTML you would add the class like so:

<span class="hebrew"> malesuada augue imperdiet eget. Cum et magnis</span>

这篇关于等效于“字体大小+ 2”的HTML样式标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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