Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why can’t <style> tags within the HTML <body> tag validate on W3C? [duplicate]

Tags:

Possible Duplicate:
Does <STYLE> have to be in the <HEAD> of an HTML document?

I am part of a team that has developed a CMS system.

We would like to be able to insert <style> tags within the <body> of an HTML page in a way that validates to W3C standards, as validation is a requirement of our SEO consultant.

The style tag functions perfectly well within the body tag across all browsers, yet it refuses to validate.

like image 283
chris Avatar asked Jan 26 '11 10:01

chris


People also ask

Can I use style tag inside body tag?

The <style> element must be included inside the <head> of the document. In general, it is better to put your styles in external stylesheets and apply them using <link> elements.

What are W3C errors?

W3C validation is the process of checking a website's code to determine if it follows the formatting standards. If you fail to validate your website's pages based on W3C standards, your website will most likely suffer from errors or poor traffic owing to poor formatting and readability.

Where can I use style tag?

HTML <style> tag When writing in HTML, the <style> tag is used to change the appearance and position of various elements on a web page. It is placed in the document's <head> and implemented as a class, or used for applying inline CSS to a single element.

What is fatal error in HTML?

A fatal error is any error that causes a program to abort.


1 Answers

The HMTL DTD does not allow it, therefore it doesn't validate. Doesn't matter, all browsers support it anyway.

like image 142
Spliffster Avatar answered Nov 12 '22 05:11

Spliffster