如何将背景图像添加到带有表的twitter引导程序页面?

时间:2012-08-23 19:19:16

标签: html css twitter-bootstrap

我的网页上有一张桌子,我想添加背景图片。我仍然希望桌子保持白色背景,但在桌子周围我希望有一个背景图像。如果我只是更改<head>中的背景图像,则白色表格的背景会变为图像,这不是我想要的。

代码:

<link href="css/bootstrap.css" rel="stylesheet">
<style type="text/css">
body {
  padding-top: 60px;
  padding-bottom: 40px;
  background-image: url('file:///....Images/background.JPG');  
  background-repeat:repeat;
  -webkit-border-radius: 6px;  
  -moz-border-radius: 6px;  
  border-radius: 6px;   
}
</style>
<link href="css/bootstrap-responsive.css" rel="stylesheet">

我该怎么做正确的方法?顺便说一句,显然我是bootstrap / html / css的新手吗?

2 个答案:

答案 0 :(得分:2)

这样想:在设置背景之前,每个元素都是透明的。你只是设置身体背景。您需要做的是,在CSS中,为您的表格提供白色背景:

table {
    background-color: white;
}

答案 1 :(得分:0)

如果您已将class="table"添加到表中(如果您尚未添加),则默认情况下Bootstrap会为其提供透明背景。添加背景颜色,它将起作用。