Solved

CSS setting table bgcolor?

Posted on 2008-10-22
3
478 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
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 Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

776 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