return to tranceaddict TranceAddict Forums Archive > Archives > Classic old threads / Inactive Forums > Retired Forums > Frequently Asked Questions / Tutorials / How do I?

 
XHTML / CSS question
View this Thread in Original format
Nell
1) Im doing a project and i have to validate my XHTML page through..

http://validator.w3.org

anyway, when i want to set background of a table cell to a particular image. normally when coding HTML, i would do (i've put decimals in to stop this thread from ing up:

quote:

<.td background="image.jpg".>


unfortunately the validator i use doesn't like it and i get this error message...

quote:

Line 35, column 51: there is no attribute "background"

<.td align="center" background="images\menubackground.jpg".>

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute.


how can i overcome this using CSS? remember i only want to do this for once table cell (td).

2) My second problem is trying to incoperate a piece of javascript succesfully.

my desired effect is to have an image, and when the mouse rolls over it, it turns into another image. i am using the following javascript to do this..

im the head:
quote:

<.SCRIPT LANGUAGE="JavaScript".>
image1 = new Image();
image1.src = "images/POTWPMO.jpg";



in the body:
quote:

<.a href="java script:popUp('images/POTWPXL.jpg')" onmouseover="image1.src='images/POTWPMO.jpg';"
onmouseout="image1.src='images/POTWP.jpg';">
<.img name="image1" src="images/POTWP.jpg" border=0>


unfortunately the validator starts rambling on about there is no "alt" tag in the body code. If i try to implement it, the stupid validator gets confused with all the " quote marks and equal signs, and doesnt have a clue what i'm trying to do.

the page im creating MUST be validated through the validator, hence all these stupidly insignificant adjustmensts im having to make.

If anyone can help, i'll love you for life!

regards,

Nell
Lira
If you want that background image to be in just one table cell, give it a name. Let's suppose you want to name it "Crispy". First...
quote:
<.table.>
<.tr.>
..........
<.td class="crispy".>
Insert whatever you want here :)
<./td.>
..........
<./tr.>
<./table.>

Then, Nell, use the following CSS command:
quote:
td.crispy {background-image: 'image.jpg'}

That background image will be displayed only in the cells named crispy (yes, you can have more than one if you want).


I don't know much about Javascript though, so I can't help with it :)
CLICK TO RETURN TO TOP OF PAGE
 
Privacy Statement