Table Class in CSS for Background Image

liunx

Guest
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?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 <!-- m --><a class="postlink" href="http://www.w3.org/TR/CSS21/colors.html#q2">http://www.w3.org/TR/CSS21/colors.html#q2</a><!-- m --> for more options/details.

Does that help?Thanks. It helps a lot.
 
Back
Top