Forum komputerowe, forum informatyczne, naprawa laptpów , forum windows, forum linux, Hardware, Overclocking,
Wyśrodkowanie tła dla body css - Wersja do druku

+- Forum komputerowe, forum informatyczne, naprawa laptpów , forum windows, forum linux, Hardware, Overclocking, (https://forum.pcmod.pl)
+-- Dział: Webmaster (https://forum.pcmod.pl/forum-38.html)
+--- Dział: (X)HTML & CSS (https://forum.pcmod.pl/forum-40.html)
+---- Dział: css (https://forum.pcmod.pl/forum-50.html)
+---- Wątek: Wyśrodkowanie tła dla body css (/thread-424.html)



Wyśrodkowanie tła dla body css - piotrvx - 2010-08-20

Na pewno wiele z was miało problem z wyśrodkowaniem, lub rozmieszczeniem tła w szablonie strony.
Kod:
* { margin: 0; padding: 0;}
  body { width: 100%; background: #4b4233; background: url(images/bg_content.gif) repeat-y; margin: 0 auto;}

Aby rozmieścić bez problemy tło wystarczy skorzystać z właściwości background-position. May do dyspozycji: top left, top center, top right, center left, center center, center right, bottom left, bottom center, bottom right, x% y%

Przykład:
Kod:
background-color: #000000;
background:#000000 url(/images/blackevo4/tlo.jpg) repeat-y; margin: 0 auto;
background-position:center;
line-height: 1.4;
margin: 25;
padding: 50;
Kod:
<table border="1" style="background-image: url(g/tlo.gif);
background-position:bottom right; background-repeat:no-repeat;">
<tr><td width="300" height="50">
<p>&nbsp;</p>
</td></tr></table>
Kod:
<style type="text/css"><!--
body { background-image: url(tlo.gif); background-position: top center; }
--></style>