Puting css in body tag

Can we put css(or atleast link to external css file) inside body tag?

If so, when i validate the page its giving me an error ( “Document type does not allow <link> element here”)?

Is there any other way i could put css inside body tag?

i am using xhtml
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

<html xmlns=“http://www.w3.org/1999/xhtml” lang=“en” xml:lang=“en”>

Thank you,



Its not valid to use the <link> or <style> in the body, it will only be valid when you use it in the <head></head>. So, if you are to care about XHTML validation with the w3c I would suggest use it in the <head></head>.

But it wouldn’t make any big problem if you use it between body tags the only problem would be your page will be an invalid XHTMLTransitional!

Good luck

thanks for your reply. Will those errors effect the performance(i mean… in loading of the page)?

No, not at all. As far as I know using styles etc in the body tags shouldn’t be a big trouble in loading ,

Good luck

According to best practice, load css as early as possible in the head, and load javascript as late as possible in the body.