problema larghezza sito e sfondo centrale

Postate qui discussioni di carattere generale riguardo a problemi di installazione e configurazione di osCommerce

Moderatore: mod Generali

Rispondi
marco ferrarese
membro Junior
membro Junior
Messaggi: 29
Iscritto il: 01/12/2005, 20:14

problema larghezza sito e sfondo centrale

Messaggio da marco ferrarese »

Innazitutto chiedo scusa perchè probabilmente questa è una cosa facilissima e ignorantissima, ma dopo aver spulciato a lungo il forum e applicato alcune delle soluzioni da me trovate, ancora non sono riuscito ad ottenere quel che voglio, ovvero il negozio centrato in mezzo alla pagina web, e applicare uno sfondo al solo corpo centrale (dove stanno column left, right e product listings tanto per intenderci), di modo che possa applicare un altro sfondo solo per le porzioni laterali della pagina esterne al negozio.
Un sito di riferimento dove potete vedere quel che vorrei fare sta qui:

http://www.tkorecords.com/catalog/

molto semplice, non è il massimo della grafica ma è semplice x capire quel che vorrei fare.

il mio ancora non è online.

Sono x ora riuscito a centrare sì il mio negozio usando il topic "larghezza sito" del forum, ma alcune volte il corpo centrale non appare centrato, ma spostato sul margine sinistro, e devo fare refresh di pagina x correggerlo, mentre header & footer sono sempre perfettamente centrati.
Per gli sfondi, ogni volta che applico uno sfondo al body, si applica sotto a tutti i box, anche a centro pagina. Io vorrei il centro pagina sotto i box nero, e i lati esterni al sito con uno sfondo .jpg

Potete aiutarmi? Grazie mille, sarò inesperto, ma ci ho davvero provato molte volte prima di postare e disturbare con quisquiglie da principiante.
marco ferrarese
membro Junior
membro Junior
Messaggi: 29
Iscritto il: 01/12/2005, 20:14

Messaggio da marco ferrarese »

ok, smanettando un pò dovrei essere riuscito a risolvere il problema di centratura del corpo centrale.... rimango in attesa di una mano per capire come variare gli sfondi, centrale ed esterno.
Grazie
Avatar utente
Manah
membro Baby
membro Baby
Messaggi: 80
Iscritto il: 13/07/2006, 12:42
Contatta:

Messaggio da Manah »

Ehm... ma sapere come hai fatto?

Aiutamola, la comunità!!!!!
cenzo
membro Junior
membro Junior
Messaggi: 6
Iscritto il: 11/11/2008, 1:36

Re: problema larghezza sito e sfondo centrale

Messaggio da cenzo »

Salve ragazzi per chi vuole centrare il proprio sito ecco come si fa .
Le istruzioni sono in Inglese ma basta usare il Google traduttore ed e´fatta.
================================
How to centre your store at a fixed width ?
================================

This tip is to centre your site at a fixed width such as on the free gnome and roundedgreen templates. These are good but in my opinion it is better to have a unique store for your ecommerce site. But thats another story. If you want to learn how to centre YOUR oscommerce store read on and learn exactly how !

The files you will be modifying in this tutorial are:
- includes/header.php
- includes/footer.php
- stylesheet.css

Step 1] First you need to open your header.php file which is found in the includes folder in either notepad or any other text editor. Now go to around line 54 and find where it says "?>" in the code. Make a new line under this (press return) and then enter the following code:

<div id="holder">

So on line 54-56 you should have the code:

?>
<div id="holder"><div id="innerholder">
<table border="0" width="100%" cellspacing="0" cellpadding="0">

If this is the case save your document and close it.

Step 2] Now open your footer.php file (also in the includes folder). Goto the very bottom of the document and insert this piece of code after everything that is already there:

</div>

Then save and close your document.

What you have just done in step 1 and 2 is put the oscommerce site in a "div" or container which we can now specify a width to and centre if we want to.

Step 3] Open your stylesheet.css file and goto the very bottom and add the following code:

#holder{
width: 780px;
margin-left:auto;
margin-right:auto;
}

This tells the "div" or container to be a set width of 780px and to have margins on both side automatically fit so it’s centered on the page.

Then find in the code (normally at the top of the file) where it says:

BODY {
...sometext
}

Leave everything in this as it is however between the two brackets at the bottom change modify it to the following:

BODY {
...sometext
margin: 0;
padding: 0;
border: 0;
text-align: center;
}

Now save and close your stylesheet file.

Step 4] Now upload all your files to your webspace using an FTP client or the built in one in CPanel or whatever control panel software your host uses. Voila you have your new beautifully centred fixed width site !
Ciao a tutti
Rispondi