Bob Cohen wrote:

> I'm trying to get my template to validate xhtml strict

Markup validation as such is not a CSS issue, so it's off-topic in the 
css-discuss list. In many cases, it's more or less a non-issue, since if 
the problem is in the use of deprecated elements or attributes, changing 
the doctype solves the validation problem.

However, if you wish to stick to a Strict version of HTML and the page 
now uses deprecated features, the you are faced with the problem of 
replacing those features by non-HTML things. And this of course makes it 
a CSS problem in practice.

As a quick (and dirty?) reference to mapping presentational HTML to CSS, 
check my
http://www.cs.tut.fi/~jkorpela/html2css.html

> <img src="hedTie.gif" alt="" width="78" height="158" align="top"
> align="top" />
>
> But . . . W3W's code validator complains about align="top" and
> border="x"

There's no border attribute in the sample code, so you must be referring 
to such an attribute elsewhere in the code. The border attribute for 
<img> is simple: it corresponds to the border-width property in CSS, 
though with different syntax for values. You can replace border="0" by 
border-width: 0 but border="2" maps to border-width: 2px (i.e., no unit 
is implied here in CSS). You can also use the border shorthand, e.g. 
border: 0, though it's technically a bit different (it also sets 
border-style and border-color).

> <img class="alignTop" src="hedTie.gif" alt="" width="78" height="158"
>       /> ^^^^^^^^^^^^^^^^
>
> And created a CSS rule
>
> img.alignTop {
> align: top;
> }
>
> which does validate.

Well it validates in the proper technical sense of "validation", namely 
markup validation, but this says _nothing_ about the CSS code, since 
markup validation does not process it all. You should use CSS checkers, 
such as http://jigsaw.w3.org/css-validator/ (well, there aren't many 
feasible alternatives) to check your CSS code.

It would tell you that there is no such property as align in CSS. The 
HTML align attribute is really polymorphic (mixed, messed up): as my 
quick summary shows, it needs to be mapped to different CSS properties, 
depending on the attribute value and context (element). In this case, 
you would need
vertical-align: top

Beware that there are oddities in browser implementations of 
vertical-align. In some situations, you might need to set line-height, 
too (to 1, probably, for an image and its container).

>  However, doing so introduces a break between
> the header and the body in IE5-7.

That's because align: top has no effect, so it does not do what 
align="top" did.

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/ 

______________________________________________________________________
css-discuss [EMAIL PROTECTED]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
List policies -- http://css-discuss.org/policies.html
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/

Reply via email to