Her linkin rengi farklı olsun dedik. Arkaplanı da buna zıt olarak belirledik. Buyrun kodlar:
<?php echo '<'.'style type="text/css"'.'>'; function rengi_ters_cevir($color){ $color = str_replace('#', '', $color); if (strlen($color) != 6){ return '000000'; } $rgb = ''; for ($x=0;$x<3;$x++){ $c = 255 - hexdec(substr($color,(2*$x),2)); $c = ($c < 0) ? 0 : dechex($c); $rgb .= (strlen($c) < 2) ? '0'.$c : $c; } return '#'.$rgb; } $ToplamLinkSayisi=3; for($x=1;$x<$ToplamLinkSayisi+1;$x++){ $colorno=rand(0,10000000); $bgno=10000000-$colorno; echo 'a:nth-child('.$x.'n){'; echo 'color: #'.strtoupper(dechex($colorno)).';'; echo 'background-color: '.rengi_ters_cevir('#'.strtoupper(dechex($colorno))).';'; echo '} '; } echo '<'.'/style'.'>'; echo '<a href="#1">1.Link</a>'; echo '<a href="#2">2.Link</a>'; echo '<a href="#3">3.Link</a>'; ?>