Convert an html 4 page to html 5 and some font tags remain.. how should handled by html 5?

what if convert an html 4 page to html 5 and some font tags remain… how should handled by html 5???

There should not be any font tags in your HTML. The font tag was deprecated years ago and replaced by the font-family, font-size, and other font-specific CSS properties. Look in any reference book for CSS “font” properties.

1 Like

yes that trying to do
but if - since site has many php includes - an html 5 find a font tag - will ignore it…?

The font tag will not pass html5 validation.
But it may still work in browsers. I’m not sure if it will override the css like in-line style attributes do, because it’s something I have never used.
It may be worth doing some tests.
But needless to say, the best course is to remove them all.

I just run a test.
It does override css like in-line styles do, but it’s worse than that, it can’t be trumped even by !important :scream:
Though if the font you intend to use is the same, that should not be an issue.

what about b = bold tag - the strong equivalent or i tag italic… that are also old,… these pass validation or at least not make problem?

I think they still validate, but will check.
Yes they are still valid.

The difference between then and now is that the tags are meant to give semantic meaning to their content.
They are Not meant to be used to style their content.

Similarly, h3 and h4 tags are valid but they are not meant to be used to display something large and bold and something not as large and bold.
br tags are valid but they are meant to indicate the beginning of a new line, not to create padding.
etc.

Can tags be misused for the purpose of styling something the way a browser displays them based on a browsers defaults for them? yes. Is it right to do so? no.

As a purely made up example:
Say I want something that isn’t a blockquote to look like a blockquote.
I struggle getting the margin, border, font etc to look the way I want it to in Firefox and using a blockquote does everything I want for me.
Tempting, isn’t it?
Then I look at the page using Edge and discover it doesn’t look the way I want it to.
If I had styled it using CSS, it would.

Anyway, back to the invalid font tags.
It could be a bit of work. Similar to taking style attributes out of tags and moving it into CSS proper.

The first I would do is put together a list of all the attributes and values.
Any that are the same and repeated could be reduced to a single CSS rule.
If adequate relationship selectors don’t exist, whatever tag it was the font tags were styling could be given a class. eg.

<font color="blue"><span>read more</span></font> 
<span><font color="blue">read less</font></span> 

to

.read {
 color: #00F;
}
...
<span class="read">read more</span> 
<span class="read">read less</span> 
1 Like

That’s impossible - HTML 4 didn’t support font tags any more than HTML 5 does - they were removed when HTML 4 was first introduced in 1997.

3 Likes

I’m not sure that’s the case with b and i, though. I don’t think they have any semantic meaning. They are basically like span—handy by meaningless hooks.

3 Likes

By that I mean, they do pass validation. There is of course a difference between whether you can or should use them in valid html5.
As I understand it, they are a throwback to the old days of ‘presentational’ tags, but have not been depreciated, in spite of there being more semantic tags such as strong and em.

1 Like

The <b> element represents a span of text to be stylistically offset from the normal prose without conveying any extra importance.

Full details: https://www.w3.org/wiki/HTML/Elements/b

The <i> element represents an span oftext that offset from the normal prose.

Full details: https://www.w3.org/wiki/HTML/Elements/i

5 Likes

Maybe try neutralize the eventual font tag itself, e.g.:

font{
    color:inherit;
    font-style:inherit;
    font-variant:inherit;
    font-weight:inherit;
    font-size:inherit;
    font-family:inherit;
    line-height:inherit;
}

EDIT) This should work the same, I think: :slight_smile:

font{
    color:inherit;
    font:inherit;
}
2 Likes

To stand a Site in SERPs search engines - must its code valid html5 and also must be mobile friendly, that is correct?

Exist and other point except from promote seo technics?

Can you clarify what you mean as css does over-ride all presentational attributes.

e.g.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
font{color:red}

</style>
</head>

<body>
<font color="blue">test</font>
</body>
</html>

I think I may have misunderstood what you were saying though.:wink:

Obviously, search engines do not require a site to have valid code in order to appear in SERPs (or there might be an awful lot fewer results shown ), but having valid (and modern) code greatly increases the possibility of search engines understanding your page, which may well help in SERPs.

Where a search is carried out from a mobile device, Google gives priority in its results to those sites it considers “mobile friendly”. Whether or not a page is “mobile-friendly” has no effect on search results from a desktop search. See https://webmasters.googleblog.com/2015/04/faqs-april-21st-mobile-friendly.html

1 Like

I was testing a different setup, though a true test we would need to see how it is in the OP’s site.

<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<style>
p { color: blue !important }

</style>
</head>

<body>
<p><font color="red">test</font> test.</p>
</body>
</html>

I did not think to style the font in css.

I would think search engines would favour valid code, but would probably ignore tags like font which have no bearing on content, though I don’t have the facts on that, it is speculation.
Though I do think code should be valid as a matter or course.

As for mobile friendly, that will only affect mobile SERPs, not desktop. But mobile is a common enough media now to be a serious consideration.

1 Like

Names of ships by convention are always written in italics - just to give one example of semantic meaning of an <i> tag

3 Likes

I think you’re just rearranging tagnames on the <i>Titanic</i>.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.