<img src="../images/x1.gif" alt="" border="0" style="background: red"/>
i mean...
is it legal to put the style="background: red" inside an img tag
is this legal :
Run it through the validator for your chosen DOCTYPE and find out.
is this legal :
You can use an inline style (what styles inside tags are called) with any properties that apply to the tag in question. Your code would be more properly written:
<img src="../images/x1.gif" alt="" style="border:0; background-color:#ff0000 ;" />
Note the changes: border moved into the style=, background-color is the property for just the color. You use background as the shorthand when you are specifying multiple properties: background-color, background-image, background-position, background-repeat, etc. all in one declaration. I also changed the color to hex since named colors won't validate. Also, always remember to leave a space between the last attribute and the forward slash terminating an empty tag (empty tags are tags without closing tags, eg: meta, link, hr, br, img)
DE
is this legal :
ok tnx
what CSS validator u r using ?
i use the w3c validator but its not checking for css inside the tags
SORRY
MY MISTAKE
IT DOES CHECKS INSIDE THE TAGS :oops:
is this legal :
DCElliot sz:
I also changed the color to hex since named colors won't validate.
- aqua,
- black,
- blue,
- fuschia,
- gray,
- green,
- lime,
- maroon,
- navy,
- olive,
- purple,
- red,
- silver,
- teal,
- white, and
- yellow.
cheers,
gary
[/]is this legal :
*Ouch* my bad. I guess I am reflecting on the fact that all my favorite colors won't validate, like "mediumvioletred" and "cornflowerblue" and "darkorchid" and of course the longest named color of all "lightgoldenrodyellow"
As for validation the W3C CSS-validator can be found at: http://jigsaw.w3.org/css-validator/ for those who didn't know. It has a text area that you can plop bits of CSS into to check them on the fly.
DE