Jump to content
Sign in to follow this  
Robai

element "font" undefined?

Recommended Posts

Please explain why this does not validate.This is my test.htm file:

<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>Some title</title></head><body><p><font>some text</font></p></body></html>

Trying to validate it herehttp://validator.w3.org/Validation result is this:

 Line 13, Column 9: element "font" undefined <p><font>some text</font></p>

Share this post


Link to post
Share on other sites

<font> is deprecated. Better to use a <span>, <div>, or other element, assign it a class or ID, and use CSS to define the font.Here is one way:

<style>p {font-family:Helvetica;}</style><p>some text</p>

Edited by jwburnside

Share this post


Link to post
Share on other sites
Please explain why this does not validate.This is my test.htm file:
<!DOCTYPE htmlPUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>Some title</title></head><body><p><font>some text</font></p></body></html>

Trying to validate it herehttp://validator.w3.org/Validation result is this:

 Line 13, Column 9: element "font" undefined <p><font>some text</font></p>

also <p style="font-size: 1em">text</p> instead of font-size you can set the attribute you need. The attibutes "translated" into css can be found here, for example: http://www.w3schools.com/css/css_font.aspciaoGabriele

Share this post


Link to post
Share on other sites

Thank you!I've looked herehttp://www.w3schools.com/tags/tag_font.aspand found there that attributes of <font> tag are deprecated, but I didn't noticed that the tag <font> itself is deprecated too.LOL :)

Share this post


Link to post
Share on other sites

Just curious why Dreamweaver 8 added <font> tag when I selected text "some text" here

<p>some text</p>

and then I clicked on Font Tag Editor button (it is on Text palette) and picked color red, which gave this result:

<p><font color="#FF0000">some text</font></p>

Why on the heavens it added <font> tag when it is deprecated (and doctype is strict)?

Share this post


Link to post
Share on other sites

Whose to say that dreamweaver conforms to the standards? From what I've gathered and many here will point out, dreamweaver should not necessarily be relied on for producing semantic, valid markup. It's best to be used as an editor with some handy features, rather than a drag and drop editor. You're better of learning the syntax anyway and the standards yourself, anyway.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...