i needed the right sidebar to be out on the right side of the window. so someone told me to put it before starting of body tag
While that person may have meant that floats should come first in source, you don't ever want HTML for the web page outside the body! Everyone has to be in the body.
All HTML pages need to be like this:
<!doctype of some sort>
<html with lang attribute>
with <title> and <meta> and <link> and <script> stuff
everything on the web page has to be in here
To get a sidebar floated, make sure it's before whatever the rest of the page is...
<body> <-- don't float or play with the body
...<sidebar>...stuff...</sidebar> <--float it
<div>..rest of page... </div><--main bulk of web page