Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    CSS and PHP, begginer problems

    Here is my code:
    Code:
    <html>
    <head>
    <title>Prva</title>
    <style type="text/css">
    table
    {
    	border=5px;
    	height=50px;
    	witdh=50px;
    }
    td.izbrana
    {
    	background=green;
    }
    </style>
    </head>
    <body>
    
    <?php
    	$N=3;
    	$zaporedna=0;
    	
    	echo "<table>";
    	for($i=1; $i<=$N; $i++)
    	{
    		echo"<tr>";
    		for($j=1; $j<=$N; $j++)
    		{	
    			$zaporedna++;
    			$izbrana=rand(1,5);
    			$string_izbrana="izbrana";
    			
    			if($izbrana==5)
    			{
    				echo"<td class=$string_izbrana> $zaporedna";
    			}
    			else
    			{
    				echo"<td> $zaporedna";
    			}
    		}
    		echo"</tr>";
    	}
    	echo "</table>";
    ?>
    
    </body>
    </html>
    I am trying to use the izbrana class every time the random is equal to 5.
    It just doesn't work.
    I am trying to achieve something like this
    ,
    but I don't, it seems like the css isn't in use.

  • #2
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,339
    Thanks
    11
    Thanked 288 Times in 287 Posts
    CSS uses colons, not equals signs, between the attribute and value, like this:
    table {border:5px}

    You also need a doctype on your html.

    Dave

  • Users who have thanked tracknut for this post:

    kajzec (01-05-2012)

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Oh, how could I be that blind. Thank you very much!
    Can someone describe me how do I get the time elapsed between the table creation and the click of the button?
    Last edited by kajzec; 01-05-2012 at 05:17 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •