Znalazłem już dosyć leciwy ( 4 lata ) artykuł o pozycjonowaniu elementów na stronie w centrum zarówno poziomo jak i pionowo.
Ostatni paragraf chyba nie do końca rozumiem. Proszę o wytłumaczenie.
link do artykułu: http://www.w3.org/Style/Examples/007/center.en.html
Cytat
The 'margin-right: -50%' is needed to compensate the 'left: 50%'. The 'left' rule reduces the available width for the element by 50%. The renderer will thus try to make lines that are no longer than half the width of the container. By saying that the right margin of the element is further to the right by that same amount, the maximum line length is again the same as the container's width.
Try resizing the window: You'll see that each sentence is on one line when the window is wide enough. Only when the window is too narrow for the whole sentence will the sentence be broken over several lines. When you remove the 'margin-right: -50%' and resize the window again, you'll see that the sentences will be broken already when the window is still twice as wide as the text lines.
Try resizing the window: You'll see that each sentence is on one line when the window is wide enough. Only when the window is too narrow for the whole sentence will the sentence be broken over several lines. When you remove the 'margin-right: -50%' and resize the window again, you'll see that the sentences will be broken already when the window is still twice as wide as the text lines.
~Dzięki.
p.s.
Jezu jak ja się cieszę że wreszcie te cholerne IE 6 i 7 odeszło do lamusa i nawet powoli 8, 9 trafia szlag! Jak ja kląłem tych kilka lat temu o rany...