Created
April 20, 2022 10:41
-
-
Save hernikplays/674e76918f68de2467946fb840a4db93 to your computer and use it in GitHub Desktop.
Tabulka násobilka v PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>Hello!</title> | |
<meta name="description" content="description"/> | |
<meta name="author" content="author" /> | |
<meta name="keywords" content="keywords" /> | |
<link rel="stylesheet" href="./stylesheet.css" type="text/css" /> | |
<style type="text/css">body { | |
width: auto; | |
font-family: 'Courier New', Courier, monospace; | |
font-size: 20px; | |
} | |
table{ | |
margin-left: auto; | |
margin-right: auto; | |
} | |
td{ | |
width: 70px; | |
height: 55px; | |
text-align: center; | |
} | |
.kraj{ | |
font-weight: bold; | |
background-color: darkblue !important; | |
color:white; | |
height: 55px; | |
} | |
tr:nth-child(even) {background: #b8ecff} | |
tr:nth-child(odd) {background: #73b2c9} | |
</style> | |
</head> | |
<body> | |
<table> | |
<tr> | |
<?php for ($i=0; $i <= 10; $i++) { | |
echo "<th class='kraj'>".$i."</th>"; | |
} ?> | |
</tr> <!-- prvni --> | |
<?php | |
for ($i=1; $i <= 10; $i++) { | |
echo "<tr>"; | |
echo "<td class='kraj'>".$i."</td>"; | |
for ($j=1; $j <= 10; $j++) { | |
if($j == $i){ | |
echo "<td style='background-color:#0dffef;'>".strval($i*$j)."</td>"; | |
} | |
else{ | |
echo "<td>".strval($j*$i)."</td>"; | |
} | |
} | |
echo "</tr>"; | |
} | |
?> | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment