PHP em CSS

Guys,

I am starting up again with programing and I am testing some stuff. However, am stuck and dunno what to do. I want to do a very simple task however it does not work. What I want to to is to create a menu that randomly changes its position each time I reload the page. I already created a simple php:

<?php $xpos = rand(30,800); $ypos = rand(30,500); echo ".menu {"; echo "left: ".$xpos.";"; echo "top: ".$ypos.";"; echo "}"; ?>

and call it in HTML via:

<? header("Content-Type: text/css") ?>

however it does not work. Yes I classed the menu and it workes fine with fixed offset numers.

Somebody can help here… thanks a lot

Try to add px after your random numbers, like this:
[php]echo "left: ".$xpos.“px;”;
echo "top: ".$ypos.“px;”;[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service