Solution example:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <style type="text/css"> div.menu { width:100%; border:0px solid black; } div.menu a { border:0px solid red; display:inline-block; width:25%; } div.menu a:hover div { border:0px solid green; background-repeat: no-repeat; background-size: contain; background-position: 50% 50%; background-image: url('ramka.png'); } div.menu a div span { border:0px solid blue; display:block; width:25%; font-size:70%; margin-left:auto; margin-right:auto; text-align:center; } </style> </head> <body> <div class="menu"> <a href=""><div style="line-height:300%;"><span>123</span></div></a> </div> </body> </html>
div.menu - contains the necessary menus, from its width we set the width of links in%.
div.menu a - display: inline-block - so that you can set the width of the link
div.menu a: hover div - background-size: contain; background-position: 50% 50%; - in the middle, so that it will fully enter (ie, either in width or in height).
margin-left: auto; margin-right: auto; - alignment span'a in the middle of div'a
text-align: center - so that the text is in the middle of the span (and hence the div, and therefore the links)
turned on the border, put instead of 0px, for example, 1px and play the other values - you will see how it affects.
Then position the elements as you want.