sIFR 3 行距和字距调整

发布于 2024-08-21 08:02:39 字数 765 浏览 8 评论 0原文

我正在尝试在我正在处理的网站上的某些 sIFR 3 类型上进行行距和字偶距调整(如 wiki 中所述:http://wiki.novemberborn.net/sifr3/Styling),但这两个参数似乎无论我做什么都没有效果。

我没有按照要求使用整数(没有“px”或“em”)。我还尝试了几种不同的字体 swf 文件,只是为了确保它不是字体。我不知道为什么它不起作用。我分配给 .sIFR-root 的所有其他 css 参数都工作得很好。这是我使用“前导”的代码示例。

在 sifr_config.js 中:

sIFR.replace(snl, {
    selector: '.section-title h1',
    css: ['.sIFR-root { color: #FFFFFF; text-align: center; leading:2; }'],
    wmode: 'transparent'
});

在 HTML 文档中:(

<div class="section-title">
    <h1>sIFR Text</h1>
</div>

我还尝试了带方括号和不带方括号的 css 代码,因为我已经看到它以两种方式完成。似乎没有什么区别)。

我做错了什么?任何帮助将不胜感激;谢谢!

I am trying to get leading and kerning to work on some sIFR 3 type on a site I'm working on (as described in the wiki: http://wiki.novemberborn.net/sifr3/Styling), but these two parameters seem to have no effect no matter what I do.

I am not using intergers (no 'px' or 'em') just as it requires. I've also tried several different font swf files, just to make sure it's not the font. I don't know why it doesn't work. All of the other css parameters that I assign to .sIFR-root work just fine. Here's a sample of my code using 'leading'.

In sifr_config.js:

sIFR.replace(snl, {
    selector: '.section-title h1',
    css: ['.sIFR-root { color: #FFFFFF; text-align: center; leading:2; }'],
    wmode: 'transparent'
});

In the HTML doc:

<div class="section-title">
    <h1>sIFR Text</h1>
</div>

(I've also tried the css code with and without the square brackets, as I've seen it done both ways. Doesn't seem to make a difference).

What am I doing wrong? Any help would be greatly appreciated; thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

热情消退 2024-08-28 08:02:39

ETA:找到了一种不那么黑客的方式:
当添加到替换元素的 CSS 时,line-height 似乎可以工作(在我的示例中为:.sIFR-active .section-title h1)。所以我能够使用常规的旧行高来伪造边距。


好吧,既然这个问题让大家都哑口无言,这就是我的发现:

最初,有很多建议使用前导来替代 margin-top 或 padding-top,因为它们不适用于 sIFR。这就是我试图用它的目的。我有一行文本,需要在顶部给它一些空间,所以我试图通过增加行距(行高)来做到这一点,但无济于事。我认为这在某一点上有效,但后来当我查看 sIFR 所有修订版的更改日志时,我发现了一条关于“修复”行距的注释。显然,开发人员认为在单行文本上识别行距是一个错误,因此“修复”了它,以便仅在文本为多行时应用行距。我通过在文本前添加换行符进行测试,果然,行距开始工作!

所以现在看来​​,为了在 sIFR 标题上实现上边距,我必须以某种方式添加不必要的代码 - 通过将其包装在具有上边距的 div 或 span 中,或者添加换行符并使用负领先。

我仍然不知道字距调整,但字母间距似乎有效,所以......

如果有人有任何额外的见解可以提供,我洗耳恭听!

ETA: Found an less hackish way:
line-height seems to work when added to the CSS for the replaced element (in my example that'd be: .sIFR-active .section-title h1). So I was able to use regular old line-height to fake a margin.


All righty—since this one left everyone speechless, here's what I discovered:

Originally, there were many suggestions for using leading as a replacment for margin-top or padding-top since these will not work with sIFR. This is what I was trying to use it for. I had a single line of text and needed to give it some space up top, so I was trying to do this by increasing the leading (line height) to no avail. I think this worked at one point, but then as I was looking at the change logs for all the revisions of sIFR, I found a note about a "fix" to leading. Apparently the developer considered leading being recognized on single-line text as a bug, so "fixed" it so that leading is only applied when the text is multiple lines. I tested by putting a line-break before my text, and sure enough, leading started to work!

So it seems that now, in order to achieve a top margin on my sIFR header, I have to add unneccessary code one way or another—by wrapping it in a div or span with a top margin, or by adding a line break and using negative leading.

I still have no idea about the kerning, but letter-spacing seems to be working, so…

If anyone has any additional insight to offer, I'm all ears!

甲如呢乙后呢 2024-08-28 08:02:39

以下是对我有用的方法,使用 sIFR 3 获得带有红色 Serifa 字体的 h2,字母间距和前导最小。实际的 sIFR swf 没什么特别的,只是根据 sIFR 文档创建的。如上所述,offsetTop和tuneHeight也可以用于调整位置(如下所示,尽管我没有使用它们,所以设置为0)。

在 sifr.css 中

.sIFR-active h2.replace {
    color: #FF0000;
    visibility: hidden;
    font-family: arial,helvetica,clean,sans-serif;
    font-size: 2.5em;
    text-transform:uppercase;
  }

在 sifr-config.js 中

sIFR.replace(serifa, {
    selector: 'h2.replace',
    css: ['.sIFR-root { letter-spacing: -2; leading: -15; kerning:true; color:#FF0000; text-transform:uppercase; font-size:2.5em; }' ], 
    tuneWidth: '0' , tuneHeight: '0' , offsetTop: '0' });

在 html 页面中(例如):

<div class="column grid_4">
    <h2 class="replace">Title here</h2>
</div>

Here's what works for me, using sIFR 3 to get a h2 with Serifa font in red with minimal letter spacing and leading. The actual sIFR swf is nothing special, simply created as per the sIFR documentation. As mentioned above, offsetTop and tuneHeight also work for adjusting positioning (shown below although I haven't used them so set to 0).

In sifr.css

.sIFR-active h2.replace {
    color: #FF0000;
    visibility: hidden;
    font-family: arial,helvetica,clean,sans-serif;
    font-size: 2.5em;
    text-transform:uppercase;
  }

in sifr-config.js

sIFR.replace(serifa, {
    selector: 'h2.replace',
    css: ['.sIFR-root { letter-spacing: -2; leading: -15; kerning:true; color:#FF0000; text-transform:uppercase; font-size:2.5em; }' ], 
    tuneWidth: '0' , tuneHeight: '0' , offsetTop: '0' });

In html page (for example):

<div class="column grid_4">
    <h2 class="replace">Title here</h2>
</div>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文