在CSS中插入背景图片(Twitter Bootstrap) [英] Insert a background image in CSS (Twitter Bootstrap)

查看:307
本文介绍了在CSS中插入背景图片(Twitter Bootstrap)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在我的网站上添加图片背景?

How can i add a image background to my website?

body {
     margin: 0;
     background: url(background.png);
     background-size: 1440px 800px;
     background-repeat:no-repeatdisplay: compact;
     font: 13px/18px "Helvetica Neue", Helvetica, Arial, sans-serif;

我做得很多,但没有显示在我的页面上。我是一个CSS初学者。

I did that much but nothing shows up on my page. I'm a CSS beginner.

更新:

body {
 margin: 0;
 background-image: url(.../img/background.jpg);
 background-size: 1440px 800px;
 background-repeat:no-repeat;
 display: compact;
 font: 13px/18px "Helvetica Neue", Helvetica, Arial, sans-serif;


推荐答案

将背景网址置于引号中。

Put the background url in quotes.

应该是 background:url('background.png');

请参阅这里进行工作演示。

您也有 background-repeat行在两个语句之间缺少分号的问题。如果你的背景真的很小,你不会看到它,因为这个问题。

You also have an issue with the background-repeat line missing a semicolon in between two statements. If your background is really tiny you won't see it because of that issue.

只是为了更新的解决方案,其他问题,背景文件正在refrenced ... / background.jpg 当它应该是 ../ background.jpg (2点,不是3)。

Just to update on the solution, among the other issues, the background file was being refrenced with .../background.jpg when it should have been ../background.jpg (2 dots, not 3).

这篇关于在CSS中插入背景图片(Twitter Bootstrap)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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