[CSS] – Centrare background all’interno di una DIV
Centrare background all’interno di una DIV
Una delle cose che ci infastidisce della programmazione CSS è centrare un oggetto o un testo. Usando text-align: center e margin: 0 auto riusciamo tranquillamente a centrarli ma il background no! Per centrare un background dobbiamo usare semplicemente background-position: center;
Esempio:
<div style="background-image:url('image/sfondo_land.jpg'); background-repeat: no-repeat; background-position: center">
Land of World
</div>