Click to See Complete Forum and Search --> : Table Class in CSS for Background Image


SJ McAbney
11-18-2004, 08:34 AM
I'm relatively new to CSS and know that in my current website I hav to use a Class to achieve a desired effect.

Currently, I have my tables as normal. There is, however, one other table in which I want to put a right justified backgroun image that doesn't repeat.

How do I do this?

DaveSW
11-18-2004, 08:42 AM
add a class or id to your table cell. Use a class if you may want to reuse the same css code on a different cell on the same page. if you know there will only ever be one instance of this per page then you can use an ID.

<td class="someName"> etc.

then in your style sheet or in the style section in the head of the document:

.someName {
background: url(image.jpg) 0% 0% no-repeat;
}

So if that was in the head section of your document it would read:

<style type="text/css"><!--
.someName {
background: url(image.jpg) 0% 0% no-repeat;
}
--></style>

instead of 0% 0% you could change % to px (pixels), or use values like left etc.

See http://www.w3.org/TR/CSS21/colors.html#q2 for more options/details.

Does that help?

SJ McAbney
11-18-2004, 08:49 AM
Thanks. It helps a lot.