Cufon线高问题

发布于 2024-08-18 10:36:39 字数 1953 浏览 2 评论 0原文

当我在 CSS 或 javascript 中应用行高时,它不会执行此操作。如果我在脚本中应用,我会收到以下错误。

Error: missing : after property id
Line: 26, Column: 44
Source Code:
Cufon.replace('#header .lists li a', {line-height: '120%;', font-size: '120%'}); 

javascript

$(document).ready(function() 
{

    Cufon.replace('#header .lists li a', {line-height: '120%;', font-size: '120%'});

});

样式.css

#header .lists { float:left; position:relative; width:776px; height:40px; list-style:none; padding:0; margin:0; margin-top:1px; background:url(../images/bg_mainmenu_off.gif); z-index:100; }
#header .lists li {float:left; height:40px; display:inline; background:url(../images/bg_mainmenu_off.gif) repeat-x;}
#header .lists li a {display:block; width:150px; height:40px; line-height:40px; text-decoration:none; font-size:16px; font-weight:bold; text-indent:10px; font-weight:bold; color:#FFFFFF; margin: 0px; }
#header .lists li a:hover { background:url(../images/bg_mainmenu_on.gif) repeat-x; }
#header .lists div {display:none; }
#header .lists :hover div {display:block; position:absolute; background:#FFFFFF; top:26px; border:1px solid #ece7d1; padding-bottom:10px;}
#header .lists :hover div dl { float:left; width:179px; display:inline; padding:5px; margin:0 5px 10px 5px;}
#header .lists :hover div dl dt { width:179px; height:16px; background:#b39f87; margin:5px 0 10px 0; text-decoration:none; }
#header .lists :hover div dl dd {padding:0; margin:0;}
#header .lists :hover div dt a { display:block; height:14px; line-height:14px; font-size:14px; color:#FFFFFF; font-weight:bold; text-decoration:none;}
#header .lists :hover div dt a:hover { background:none;}
#header .lists :hover div dd a { display:block; height:14px; line-height:14px; font-size:14px; color:#b39f87; font-weight:normal; text-decoration:none; }
#header .lists :hover div dd a:hover {text-decoration:underline; background:none;}

When I apply line-height in CSS or in javascript, it does not do it. And if I apply in the script, I get the following error.

Error: missing : after property id
Line: 26, Column: 44
Source Code:
Cufon.replace('#header .lists li a', {line-height: '120%;', font-size: '120%'}); 

javascript

$(document).ready(function() 
{

    Cufon.replace('#header .lists li a', {line-height: '120%;', font-size: '120%'});

});

style.css

#header .lists { float:left; position:relative; width:776px; height:40px; list-style:none; padding:0; margin:0; margin-top:1px; background:url(../images/bg_mainmenu_off.gif); z-index:100; }
#header .lists li {float:left; height:40px; display:inline; background:url(../images/bg_mainmenu_off.gif) repeat-x;}
#header .lists li a {display:block; width:150px; height:40px; line-height:40px; text-decoration:none; font-size:16px; font-weight:bold; text-indent:10px; font-weight:bold; color:#FFFFFF; margin: 0px; }
#header .lists li a:hover { background:url(../images/bg_mainmenu_on.gif) repeat-x; }
#header .lists div {display:none; }
#header .lists :hover div {display:block; position:absolute; background:#FFFFFF; top:26px; border:1px solid #ece7d1; padding-bottom:10px;}
#header .lists :hover div dl { float:left; width:179px; display:inline; padding:5px; margin:0 5px 10px 5px;}
#header .lists :hover div dl dt { width:179px; height:16px; background:#b39f87; margin:5px 0 10px 0; text-decoration:none; }
#header .lists :hover div dl dd {padding:0; margin:0;}
#header .lists :hover div dt a { display:block; height:14px; line-height:14px; font-size:14px; color:#FFFFFF; font-weight:bold; text-decoration:none;}
#header .lists :hover div dt a:hover { background:none;}
#header .lists :hover div dd a { display:block; height:14px; line-height:14px; font-size:14px; color:#b39f87; font-weight:normal; text-decoration:none; }
#header .lists :hover div dd a:hover {text-decoration:underline; background:none;}

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

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

发布评论

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

评论(9

捎一片雪花 2024-08-25 10:36:40

我知道我参加 cufon 聚会可能有点晚了,但我阅读了上面的一些使用 margin 的解决方案。我尝试过这个,但就我而言,我需要“更紧”的行高。我尝试了负值,但仍然不起作用。我发现你需要显示 cufon 生成的标签来阻止。

这是一个代码片段:

.myClass cufon { display: block; float: left; margin-top: -3px!important; }

这似乎很有效。

祝你好运。这是一个危险的世界。

I know I might be a little late to the cufon party, but I read some of the solutions using margin, above. I tried this, but in my case, I needed a "tighter" line-height. I tried a negative value but it still didn't work. I figured out that you need to display the cufon generated tag's to block.

Here's a code snippet:

.myClass cufon { display: block; float: left; margin-top: -3px!important; }

This seems to work a treat.

Good luck out there. It's a dangerous world.

红尘作伴 2024-08-25 10:36:40

这对我有用:

## main-content .cufon-canvas {height: 25px !important;}

This works for me:

## main-content .cufon-canvas {height: 25px !important;}
最美的太阳 2024-08-25 10:36:40

对于那些仍在寻找答案的人。
块元素中的每个单词均由 Cufon 分隔,

因此请尝试以下操作:

.yourCufonDiv .cufon-canvas {margin-bottom:5px;}

For the people who are still looking for an answer.
Every word is separated by Cufon in block elements

So try this:

.yourCufonDiv .cufon-canvas {margin-bottom:5px;}
哀由 2024-08-25 10:36:40

我已经解决了这个问题,如下。 Cufon 在文档准备就绪时创建 标签。
我在 .css 文档中定义了这样的 CSS 样式。 (我的 cufon Text 在 .HeaderArea 类中)

.HeaderArea cufon { margin-bottom:10px; }

I've solved the problem as follows. Cufon creates <cufon> tags at document ready.
I define a CSS style like this in my .css document. (my cufon Text in the .HeaderArea class)

.HeaderArea cufon { margin-bottom:10px; }
断爱 2024-08-25 10:36:40

为了使 line-height 与 Cufon 配合使用,您需要将上述内容更改为严格的 DOCTYPE

访问:http://xsdesigns.se/2012/08/not-just-seo -但是一点点编码技巧以及cufon字体和行高问题修复/

For line-height to work with Cufon, you need to change the above into the Strict DOCTYPE

Visit:http://xsdesigns.se/2012/08/not-just-seo-but-a-little-bit-of-coding-tips-as-well-cufon-fonts-and-line-height-problem-fix/

多情出卖 2024-08-25 10:36:39

Cufon 中存在一个可能无法修复的已知错误 关于具有非严格文档类型的页面上不稳定的行高识别。

There is a known bug in Cufon that will probably not be fixed regarding flaky line-height recognition on pages with non-strict doctypes.

做个少女永远怀春 2024-08-25 10:36:39

另外,以下 CSS 样式对我有用,无需更改 Doctype(如 Keith 之前的帖子)

div#navigation ul li cufon {
    padding-bottom: 3px;
}

干杯

Also the following CSS styling worked for me without Doctype change (like the post from Keith before)

div#navigation ul li cufon {
    padding-bottom: 3px;
}

Cheers

生寂 2024-08-25 10:36:39

我们(@markedup 实际上)找到的一种解决方案是在您拥有的元素内的文本周围包裹一个跨度问题,所以:

<h1><span>Some text here that is giving you a bit of a headache</span></h1>

在子跨度上添加底部填充,鲍勃是你母亲的兄弟。

使用一些额外的代码,但比指定错误的文档类型更好,从而导致潜在的无效页面和 b0rked css。

干杯。

One solution we (@markedup actually) have found is to wrap a span around the text inside the element you are having issues with, so:

<h1><span>Some text here that is giving you a bit of a headache</span></h1>

Add bottom padding on the child span and bob's your mothers brother.

Uses a bit of extra code but better than specifying the wrong doctype, resulting in potential invalid pages and b0rked css.

Cheers.

找个人就嫁了吧 2024-08-25 10:36:39

我忍不住提一下:

{line-height: '120%;',

你可能想将其更改为:

{'line-height': '120%',

因为 javascript 解析器可能会在“-”运算符上中断..

I can't help to mention:

{line-height: '120%;',

you might want to change this into:

{'line-height': '120%',

since javascript parsers might break on the '-' operator..

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