【问题标题】:How to use a image as a background with out it being blurry如何将图像用作背景而不会模糊
【发布时间】:2017-11-04 00:50:14
【问题描述】:

在我生命的最后一个小时里,我一直在寻找如何让我的网站背景成为图像。我找不到一篇有助于解释它或起作用的帖子。

代码:

body {
   background: url('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSdA1670FJVHsBy1-mv6eF8xnLJi5rp-09t0102mSD6QDcxObMKnA');
   background-size: cover;
   background-repeat: no-repeat;

图像非常模糊,如何解决?

【问题讨论】:

  • 你使用的图片只有20px宽,拉伸会模糊。如果您设置了背景图像,则需要更大的图像来覆盖更大的区域
  • 我需要多大的尺寸?

标签: html css image background


【解决方案1】:

只需使用质量更好的图片

body {
  background: url('http://images.summitpost.org/original/462463.jpg');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  height: 100vh;
}
<h1>Some content</h1>

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2012-07-30
  • 1970-01-01
  • 2015-10-09
  • 2013-12-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多