网站标题横幅的文本与图像?

发布于 2024-09-28 11:23:05 字数 222 浏览 0 评论 0原文

我正在创建的网站的横幅标题文本相当大。使用普通字体会使其看起来非常锯齿状,但看起来抗锯齿图像的下载量相当大。哪种方式是最佳选择,或者对于大型标题有更好的方法吗?

这是带有纯文本的横幅。缩小后并不那么明显,但全尺寸时它的宽度约为 600 像素。单独打开图像以获得完整效果:

Aliased Text

The website I am creating has a fairly large title text for its banner. Using a plain font gives it a very jagged look, but it seems like an anti-aliased image would be a fairly large download. Which way would be the best choice, or is there a better method for large titles?

Here is the banner with pure text. Scaled down it is not as noticeable, but full size it's about 600px across. Open the image separately for the full effect:

Aliased Text

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

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

发布评论

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

评论(3

我最亲爱的 2024-10-05 11:23:05

就锯齿而言,某些字体比其他字体更好。话虽这么说,与文本颜色相同且具有一个像素模糊的无位移文本阴影将解决大多数情况下的问题:

h1 {
   .
   .
   .
   color: white;
   text-shadow: 0 0 1px white;
}

我发现它足以对字体进行抗锯齿,如果我不使用文本阴影来实现任何其他效果,对于任何相当现代的东西来说,它都是一个很好的解决方案。较旧的浏览器(您知道您是谁)会出现锯齿,但您无法赢得所有锯齿。

Some fonts are better than others where the jaggies are concerned. That being said, a no-displacement text shadow the same color as the text with a blur of one pixel will cure what ails ya most of the time:

h1 {
   .
   .
   .
   color: white;
   text-shadow: 0 0 1px white;
}

I've found that it's just enough to antialias the font, and if I'm not using the text-shadow for any other effects, it's a good solution for anything even reasonably modern. Older browsers (you know who you are) will get the jaggies, but you can't win 'em all.

維他命╮ 2024-10-05 11:23:05

图像是我要走的路。有技术可以使图像尺寸更小,而不会放弃太多的术语的质量。另外,第一次下载后,它可以被缓存,因此不需要再次下载。

Image is the way i would go. There are techniques out there for making the image smaller in size without giving up too much in terms of quality. Plus, once it's downloaded the first time, it can be cached so it won't need downloaded again.

捂风挽笑 2024-10-05 11:23:05

我始终建议不要使用图像作为文本内容。现代浏览器具有内置的抗锯齿功能,因此大字体看起来比几年前要好得多。 (而且它正在变得越来越好。)此外,使用诸如

之类的标记可以让您保留标题的语义值,当您使用 < 时,该语义值就会丢失。 img> 标签或 CSS background-image

I would always advise against using images for text content. Modern browsers have built-in anti-aliasing capabilities, so large fonts look much better than they did a few years back. (And it's getting better by the day.) Also, using markup such as <h1> allows you to retain the semantic value of your title, which is lost when you use an <img> tag or a CSS background-image.

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