how do I get the css and the html into the function?

<html>
<head>
<script type="text/javascript">
function myFunction()
{
return ("Hello world!");
}
</script>
</head>
<body>
<div style="float:right;">
<script type="text/javascript">
document.write(myFunction())
</script>
</div>
</body>
</html>

I think here is your answer..

<html>

      <head>

      <script type="text/javascript">

      function myFunction()

      {

      return ("<h1 style='color:red;background-color:gray'>Hello world!</h1>");

      }

      </script>

      </head>

      <body>
        <div style="float:right;">
        <script type="text/javascript">

      document.write(myFunction())

      </script>

      </div>
        </body>

  </html>

That certainly works. Thanks.