Forum Moderators: open

Message Too Old, No Replies

HTML 4 Strict Difficulties

         

ukgimp

11:24 am on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have a site that is transitional but I would like to get it to strict. I am however having a few troubles with a couple of areas. So here goes with the most difficult ones.

Is there a way to delclare td widths in:
<td width="23%" class="dark">Text</td>

There is a warning for a whole bunch of things that are fowling up my attempts:

"document type does not allow element "INPUT" here; missing one "P", "H1", "H2", "H3", "H4", "H5", "H6", "PRE", "DIV", "ADDRESS" start-tag"

For those that may say get rid of the tables, I cant :)

Any pointers gratfully recieved.

Cheers

DrDoc

11:31 am on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, the TD width can be solved with CSS.

The input problem has to do with the fact that <input> fields (or any other content, except block level elements) are not allowed immediately within <form>

Invalid:

<form>
Text<br>
<input>
</form>

Valid:

<form>
<div>
Text<br>
<input>
</div>
</form>

ukgimp

1:13 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for that DrDoc.

Funny thing though, now it is html 4 compliant the freaking text goes small across the whole page. If I remove the doctype it goes back to normal.

I do have % text, could that be the error of my ways.

DrDoc

1:24 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



% how? Using CSS?

ukgimp

1:34 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I inherited the css.

eg

p {
font-size: 80%
}

In fact I have been working on it now over lunch and it seems to be that % that causes the problem. So I have to take all the text up one size, so where I want 80% and the strict doctype I need to go to "small" text size.

DrDoc

1:37 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In all browsers, or just in some? It should be ok to use % (or ems)... I do that all the time. Any particular browser that makes the text smaller?

Are the <p> tags closed?
Also, if you have set the overall body size to 80%, setting the size of paragraph fonts to 80% actually means "80% of body size", which would be about 64% of browser default...

DrDoc

1:41 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, don't use "small" or other keywords for sizes. They are so poorly supported! Some browsers default to "small" where others default to "medium".

Use % or em. Just remember that explicitly setting the size for a child element makes the takes relatively smaller compared to its parent.

<body>
Test
<div>
Test
<p>
Test
</p>
</div>
</body>

Setting font size to 50% for each element (body, div, and p) would make the text in the above example smaller and smaller...

ukgimp

1:53 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What about number formats

as in 1 - 7?

are they supported widely?

grahamstewart

1:54 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yup Doc is right. Stay away from keywords and use % (or em). When you set font size to be 80% it means 80% of the parent element's font size. So you need to think about how this cascades through the heirarchy.

One way to handle this is to only set the font size in either the outer-most or the inner-most elements - just not both!

DrDoc

2:03 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



number formats

Are we talking CSS or font tags now? If the latter - yes, but stay away from font tags ;) They are evil! 1-7 for CSS, well, no, they are not supported at all...

ukgimp

3:46 pm on Apr 14, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks, most appreciated.