0
<!DOCTYPE html>
<html>
<body>
  <p style="font-family:Algerian;color:red;font-size:34">Bridge</p>
</body>
</html>

Copy/Paste this source code. The font-family and color work. The font doesn't size. Remove the Doctype tag, the font sizes beautifully. PC based browsers Chrome, Firefox, IE, and Opera work fine without the tag, but what about mobile devices?

Tried styling the paragraph from the head. Didn't work. Tried listing the style attributes in different orders. Didn't work. Tried suggested doctypes: html5, different transitional and loose doctypes. None of them worked.

Ran the code in W3C Validator. Followed the suggestion to add a UTF-8 meta tag. Didn't work.

So, what's the fix? Is there a doctype I didn't find that will work? Is there another way to style the font-size? A font tag works, but the tag is deprecated, and might get removed for newer browsers. And, I'm still not sure about mobile devices. Will they work without the doctype? I'm stumped. What woul;d be the best coding approach?

1 Answer 1

0

You forgot to add px to the font-size so font-size: 34px;

Without a Doctype, Web Browsers enter Quirks Mode where sizes are defined as pixels (px) if the unit is left off

1
  • Adding px worked, but the real bonus is your explanation of Quirks Mode. Sounds as if the doctype tag not only specifies the document type, but also benevolently forces one to use formal, not quirky, coding.
    – JimM
    Commented Nov 25, 2013 at 18:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.