简体   繁体   English

将背景颜色设置为页面

[英]Set background colour to page

I am using .net framework 4.5. 我正在使用.net Framework 4.5。 I have created a web form, that has a table. 我创建了一个带有表格的Web表单。 I am using one image as background image. 我正在使用一张图像作为背景图像。 That image is nothing but a white bar having gray at both left and right corner. 该图像不过是一个白色的条,在左右两个角都有灰色。 But when I am using, able to see white my page having a gray bar at both corner with white background. 但是,当我使用时,能够看到白色的页面在两个角落都带有白色背景的灰色条。

  1. Getting: white background gray bar white page 获取:白色背景灰色栏白页
  2. Want: I want Gray background white page 想要:我想要灰色背景白页

I don't want a white background. 我不要白色背景。

<table align="center" bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="6" style="background-image: url(../Images/bar.jpg)" width="900">
   <tr>
       <td>
       </td>
   </tr>
</table>

What shall I do? 我该怎么办?

According what i understood you are asking how to change the background of the table from white to grey.You just have to simply change your code from 根据我的理解,您正在询问如何将表格的背景从白色更改为灰色。您只需要简单地将代码从

 <table align="center" bgcolor="#ffffff" border="0" cellpadding="3"
    cellspacing="6" style="background-image: url(../Images/bar.jpg)"
    width="900">

to this 对此

<table align="center" bgcolor="#808080" border="0" cellpadding="3"
        cellspacing="6" style="background-image: url(../Images/bar.jpg)"
        width="900">

Where i have changed the background of the table from #ffffff (which is the color code of white) to #808080(which is the color code of gray) 我将表格的背景从#ffffff(这是白色的颜色代码)更改为#808080(这是灰色的颜色代码)

Not sure what you want exactly. 不确定您到底想要什么。 Try the following solution. 请尝试以下解决方案。

<table classname="custom-table" align="center" cellpadding="3" cellspacing="6">
   <tr>
     <td></td>
   </tr>
</table>

CSS 的CSS

.custom-table {
   background-image: url(../Images/bar.jpg);
   background-repeat: repeat;
   width:900px;
   border:0px;
   background-color:#fff;
} 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM