Forum Moderators: open

Message Too Old, No Replies

Help with HTML and Fonts for Auto-Translated Page

         

gouri

9:02 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I was hoping someone could please help me with this. It would really help me. For the two bullet points below and also for the text after that I want it to appear with Arial font, size 3 as I specify in the coding before the beginning of the list.

When looking at the page in English it appears ok, but when I have the page translated into French using Google France, for example, the list and the text below it appears as some sort of font that the template contains.

This is what validator mentions (maybe it will help to figure out what might work, the greater than sign in <ul> is in red):document type does not allow element "ul" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag.
<ul>
The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

The code is the following:

<font face="arial" size="4"><strong>text here</strong></font><font face="arial" size="3"><br />
<br />
text here <br />
<br />
text here<font face="Verdana" size="3"><br />
<br />
<strong>text here</strong></font><font face="arial" size="3">
<ul>
<li><strong>text here </strong>text here </li>
<li><strong>text here </strong>text here
</li>
</ul>
text here<br />
<br />
<a href="file.html">click here</a></font><br />
<br />
</font>

tedster

9:28 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The <ul> element is a block level element and <font> is an inline element. Inline elements should not contain block level elements. Although browser error recovery sometimes - but not always - can handle that kind of thing, other kinds of parsing will often choke.

Yes, being this precise in your mark-up will mean you are opening and closing font elements every time your page moves to a new block element, such as <p>, <ul> and so on. That creates very bloated code, which is just one of the failings of the font element and one of many reasons that it has been deprecated.

My best advice is do not write new source code today that uses the font element.

gouri

10:20 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you for explaining that to me.

Does this mean that every bullet point will need to have its own opening and closing font tag with Arial as the font and the size specified as 3 in order for it to look that way?

Somthing like this: <li><font face="arial" size="3"><strong>text here </strong>text here</font> </li>

Is there any other way?

I know it is not good to use the font tag because it can created bloated code but for this I have to.

tedster

10:23 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes.

If you have access to the <head> section of your source code, you can place one style rule for all your <li> there. Something like this:

<style type="text/css">li{font-family:arial,sans-serif;font-size:100%;}</style>

If you cannot access the <head> section, then you are stuck with inline styles, and that means a style attribute for every <li> tag. Just a bit more economical than the <font> tag, but at least it's not deprecated.

<li style="font-family:arial,sans-serif;font-size:100%;">

gouri

10:40 pm on Jan 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you for mentioning these options, and also for telling me how to code it.

The template that I use has Server-side Includes, and I think in there I might be able to put a style rule. Do you know possibly if Server-side Includes are in the <head> section of the source code?

Also, would I have to mention the equivalent a size 3 font in Arial in pts since it is CSS?

The inline code that you wrote looks good but that would increase the size of the code and I think I should try not to.

tedster

2:51 am on Jan 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The includes will be "included" wherever the original source code calls them - yes, it is very possible that the <head> section is an include file.

You can define the font-size in many ways. See [w3.org...]

swa66

4:18 am on Jan 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I've not written <font size="3"> in a long time, but a quick google session turned up that for Arial with the depreciated <font> tag set to size="3",
the font's size should be more or less equivalent to font-size set to either
16px, 13pt, 105%, or 1.05em But I guess it all depends on source, browser and OS used by the one determining this.

Anyway, if you set the font property using CSS for the <ul>, it'll be inherited by the <li>'s in it
So if you want to write it inline, go for something like:


<ul style="font:1.05em Arial, Helvetica, sans-serif">
<li>one</li>
<li>two</li>
</ul>

If you set the font on the <body> or so you don't need to actually bother repeating the font-family in the rest of your document.

A font-family really should be a list. E.g. Arial isn't available on *all* platforms, Helvetica looks more or less like it, and the sans-serif font is a universal one that the browser will choose if all those in front are missing. This list is a list of preferences: the first one the browser has available will be used. [Otherwise it'll become courier in many browsers]

tedster

5:52 am on Jan 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



set the font property using CSS for the <ul>, it'll be inherited by the <li>'s in it

Thanks swa - headsmacking stupid over here.

gouri

2:58 pm on Jan 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is really excellent info, thanks.

I am going to try what Swa said about putting the style with <ul>.

If the template has trouble with inline CSS, then maybe I can do what Ted said.

I had one question that I had trouble finding the answer to. I needed to know for trebuchet ms size 2 what is the size in pixels? In pts I think it is a 10 but I could not find something on the internet that would give me the equivalent. This is something that I need to know.

I would appreciate if you could please help me.

gouri

4:35 pm on Jan 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



On most of my pages on my sites, I use the font tag and I use size with that to specifiy the size of the font. Is it ok to have mostly that type of HTML and then maybe once or twice use inline CSS on a couple of pages? Or is it better to use only external CSS? There is currently external CSS also being used on the sites from the server-side includes.

tedster

8:30 pm on Jan 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'd suggest you study the font size information at the W3Schools, gouri. There's a link I placed earlier that gives you a good starting place.

tedster

9:06 pm on Jan 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Is it ok to have mostly that type of HTML and then maybe once or twice use inline CSS on a couple of pages?

It is not valid to do what you suggest, because of the font tags - but it will "work" for now.

If you go with all css: external, in the <head> and inline, the "cascade" will take care of any rules that seem to conflict. It will choose the inline style over any style declared in the head or the external style sheet.

You may find our "CSS Crash Course" useful: [webmasterworld.com...]

gouri

9:57 pm on Jan 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thank you for helping me with this. This really helps me to understand what I can do.

Also, thanks for the link to the information on CSS.

gouri

2:03 pm on Jan 28, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If I am using the <ul> markup once on three separate pages, do I have to make it <ul class> or if I don't, is it ok if I do?

gouri

6:34 pm on Jan 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<li style="font-family:arial,sans-serif;font-size:100%;">

Since the font-size is set to 100% does that mean that the text that is defined by CSS (whatever I put in my list in this example) will be approximately the same in size as the text around it defined in HTML (which would be Arial size="3"?

tedster

7:55 pm on Jan 29, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The W3C sets the standards recommendations.

<percentage>
A percentage value specifies an absolute font size relative to the parent element's font size.

[w3.org...]