html - Bootstrap 背景图片

标签 html css twitter-bootstrap

好的,基本上它不会显示我的背景图片。我查看了所有其他帖子,但没有一个有效。这是代码。

这是 Html。请注意,app.css 和 app.js 只是重命名的 Bootstrap 文件。

<!DOCTYPE html>
<html lang="en-us">
	<head>
		<meta charset="UTF-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width-device-width, initial-scale=1" />
		<!-- Above is Important -->
		<meta name="description" content="HTML, CSS, BOOTSTRAP" />
		<meta name="author" content="James Mehltretter" />
		<title>Download Free HTML Templates</title>
		<link rel="stylsheet" href="app.css" type="text/css" />
		<script src="app.js" type="text/javascript"></script>
	</head>
	<body>
		
	</body>
</html>

这是我编辑的 CSS 部分。

body {
  margin: 0;
 background-image: url(background.png);

}

JavaScript 文件只是通用 Bootstrap 。这是我实际使用的文件的链接。

The Bootstrap JS

谢谢。

最佳答案

你的 body 没有高度,也没有任何东西可以放在背景上。

确保你的 body 有一定的高度。

body {
  margin: 0;
  background-image: url(https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png);
  background-size: 1440px 800px;
  height: 300px;
}

关于html - Bootstrap 背景图片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33685070/

相关文章:

html - 我们是否仅使用 doctype 在 IE6 标准模式下呈现网页?

jquery - 无法在弹出式灯箱上的文本字段中输入

jquery - Bootstrap 的样式导航栏

css - 是否可以将 !important 作为参数/选项传递给 LESSCSS 混合?

javascript - 如何在 div 中居中 Bootstrap 容器?

html - 如何使背景图像在加载时从灰度淡化为彩色?

html - 全 Angular div 中的多种背景颜色和图像

javascript - 无法控制 z-index 最小的 div

css - 背景如何避免背景色铺满整个页面?

javascript - 如何使 react Bootstrap 工具提示适合容器?