Solved

CSS setting table bgcolor?

Posted on 2008-10-22
3
481 Views
Last Modified: 2012-05-05
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
Comment
Question by:axtur
3 Comments
 
LVL 4

Accepted Solution

by:
Jerrod_W earned 300 total points
ID: 22782128
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
 
LVL 1

Assisted Solution

by:nick_bal
nick_bal earned 200 total points
ID: 22782213

<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
 

Author Closing Comment

by:axtur
ID: 31509006
Very helpful to begin with, thank you!!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question