• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 509
  • Last Modified:

CSS setting table bgcolor?

I'm trying to change my old HTML code to XHTML Strict with CSS (begining with it), I dont know much about CSS yet, how do i set the next HTML simple code (a table bgcolour and some other attributes) using CSS??

I have this:

<table width="1000px" border=0 bgcolor="232323" align="center">

I want those attributes in css
0
axtur
Asked:
axtur
2 Solutions
 
Jerrod_WCommented:
You could create a class, and assign that class to the table properties. Look at the attached for the CSS. Follow in the html, define the table as follows:

<TABLE class="mytable">

See if that works for you.
.mytable{
width: 1000px;
background-color: #232323;
border-style: none;
margin-left: auto;
margin-right: auto;
}

Open in new window

0
 
nick_balCommented:

<style>
.mytable{ 
width:1000px; 
background:#232323; 
border:none;
text-align:center;
} 
</style>
 
<table class="mytable">
<tr><td>This is a table</td></tr>
</table>

Open in new window

0
 
axturAuthor Commented:
Very helpful to begin with, thank you!!
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now