PER TABELLE....

« Older   Newer »
  Share  
Victoria Black
view post Posted on 3/1/2009, 00:38




I PRIMI RUDIMENTI SULLE TABELLE

Beh...tutti sappiamo come creare una tabella normale.....basta andare in amministrazione--->gestisci codici html--->genera tabella con grafica uguale al forum e,inserendo il numero di colonne e righe,avremo la nostra tabella. Unica pecca è che è una semplicissima tabella...e se vogliamo qualcosa di più originale e complesso?o inserire dei sottotitoli? questo vi verrà spiegato in questo tutorial.
Innanzitutto diciamo che ci sono due parti che devono essere sempre presenti nelle nostre tabelle:la parte di apertura e la parte di chiusura e sono poste rispettivamente all'inizio e alla fine del codice. In mezzo possiamo inserire le varie celle.

Parte di apertura:
SPOILER (click to view)
CODICE
<table class="skin_tbl" align="center" cellpadding="0" cellspacing="0"> <tr> <td class="mleft_top"> </td> <td> <table class="mback" width="100%" cellpadding="0" cellspacing="0"> <tr> <td class="mback_left"> </td> <td class="mback_center">

<div class="mtitle">TITOLO</div>

</td> <td class="mback_right"> </td> </tr> </table> </td> <td class="mright_top"> </td> </tr> <tr> <td class="mleft"> </td> <td> <table class="mainbg" style="text-align:center;width:100%" cellpadding="4" cellspacing="1">


Dove c'è scritto "TITOLO" mettiamo appunto il titolo della nostra tabella

Parte di chiusura:
SPOILER (click to view)
CODICE
</table> </td> <td class="mright"> </td> </tr> <tr> <td class="mleft_bottom"> </td> <td> <table class="msub" width="100%" cellpadding="0" cellspacing="0"> <tr> <td class="msub_left"> </td> <td class="msub_center"> &nbsp;</td> <td class="msub_right"> </td> </tr> </table> </td> <td class="mright_bottom"> </td> </tr> </table> <br> <br>


Nel mezzo tra un codice e l'altro vi sarà il codice delle celle,questo è il codice per una sola riga e una sola colonna:

SPOILER (click to view)
CODICE
<tr title="RIGA1">
<td class="ww"> COLONNA1</td>
</tr>


Se vogliamo aggiungere più righe basterà aggiungere un <td class.... per ogni colonna in più che vorrete....se per esempio ne vorremo due il codice sarà:

CODICE
<tr title="RIGA1">
<td class="ww"> COLONNA1</td>
<td class="aa"> COLONNA2</td>
</tr>


DUE COSE IMPORTANTI:
1) RICORDATEVI SEMPRE D'INSERIRE LE COLONNE IN PIU' TRA IL TAG <tr> E LA SUA CHIUSURA </tr>
2)ALTERNATE SEMPRE WW E WW(COME HO FATTO IO,questo però servirà solo ad alternare i colori nel caso nel css della skin i colori di .aa e .ww siano diversi)

Una dicitura sbagliata per esempio è la seguente:

CODICE
<tr title="RIGA1">
<td class="ww"> COLONNA1</td>
</tr><td class="aa"> COLONNA2</td>


Quest'ultimo non funzionerà...

Per avere più righe invece occorrerà aggiungere l'intero codice sopra citato,esempio per due righe:

SPOILER (click to view)
CODICE
<tr title="RIGA1">
<td class="ww"> COLONNA1</td>
</tr>

<tr title="RIGA2">
<td class="ww"> COLONNA1</td>
</tr>


Per modificare i contenuti delle celle sostituire a "COLONNA1" il contenuto che volete inserire,RICORDATEVI D'INSERIRE IL CONTENUTO SEMPRE TRA IL TAG <td> E LA SUA CHIUSURA </td> ALTRIMENTI VI VERRà UN OBROBRIO.

Passiamo adesso alle modifiche più originali:

I SOTTOTITOLI

Come inserire dei sottotitoli?
Semplice...basta inserire questo codice prima di ogni codice relativo alle righe:

CODICE
<tr>
<td class="title">SOTTOTITOLO COLONNA 1</td>
</tr>


Questo è il codie relativo a una colonna,relativo a due sarà:

CODICE
<tr>
<td class="title">SOTTOTITOLO COLONNA 1</td>
<td class="title">SOTTOTITOLO COLONNA 2</td>
</tr>


Insomma dovrete aggiungere la parte centrale con le stesse modalità dette per le colonne prima,aggiungerete un "SOTTOTITOLO COLONNA" per ogni colonna della riga
Il sottotitolo dovrete scriverlo al posto di "SOTTOTITOLO COLONNA"

Ma abbiamo detto che va inserito prima del codice relativo alle righe,un esempio?eccolo:
SPOILER (click to view)
CODICE
<tr>
<td class="title">SOTTOTITOLO COLONNA 1</td>
</tr>

<tr title="RIGA1">
<td class="ww">COLONNA1</td>
</tr>


Questo ovviamente inserito in mezzo alla parte iniziale e quella conclusiva del codice della tabella

Esempio per due colonne:

SPOILER (click to view)
CODICE
<tr>
<td class="title">SOTTOTITOLO COLONNA 1</td>
<td class="title">SOTTOTITOLO COLONNA 2</td>
</tr>

<tr title="RIGA1">
<td class="ww">COLONNA1</td>
<td class="aa">COLONNA2</td>
</tr>


IL COLSPAN

Cos'è questo vocabolo strano?non è altro che la funzione con la quale si allunga una cella su più colonne...per esempio:

COLSPAN SU DUE COLONNE
CONTENUTOCOLONNA UNICA
COLONNA1COLONNA2COLONNA2
 
Come otteniamo questo effetto?semplicemente con la funzione colspan che non è niente di complicato...basterà scrivere "colspan="numero di colonne sulla quale allungare una cella"(senza le virgolette) e porlo dopo il "ww" o l'"aa"

Ecco per esempio il codice per la tabella d'esempio(posto solo la parte centrale ma voi ricordate di aggiungere anche la parte iniziale e la finale):

SPOILER (click to view)
CODICE
<tr title="RIGA1">
<td class="ww" colspan="2">CONTENUTO</td>
<td class="ww" >COLONNA UNICA</td>
</tr>

<tr title="RIGA2">
<td class="ww">COLONNA1</td>
<td class="aa">COLONNA2</td>
<td class="aa">COLONNA2</td>
</tr>


NOTE IMPORTANTI:


Ricordate che quando inserite un colspan questo conta come più colonne a seconda del numero che gli avete dato...se do un colspan="2" quesa colonna vale come due quindi non potrò mettere una sola colonna nella riga successiva ma ne dovrò inserire due.

Giusto:

SPOILER (click to view)
<tr title="RIGA1">
<td class="ww" colspan="2">CONTENUTO</td>
<td class="ww" >COLONNA UNICA</td>
</tr>

<tr title="RIGA2">
<td class="ww">COLONNA1</td>
<td class="aa">COLONNA2</td>
<td class="aa">COLONNA2</td>
</tr>


Sbagliato:

SPOILER (click to view)
CODICE
<tr title="RIGA1">
<td class="ww" colspan="2">CONTENUTO</td>
<td class="ww" >COLONNA UNICA</td>
</tr>

<tr title="RIGA2">
<td class="ww">COLONNA1</td>
<td class="aa">COLONNA2</td>
</tr>


Vedete?la somma dei td class della prima riga deve essere uguale alla somma della seconda e se nella prima riga ho un colspan 2 nella somma non lo dovrò contare come uno ma come due..se ho un colspan 3 lo dovrò contare come 3 e via dicendo.....

Come inserire un sottotitolo a una riga in cui è presente un colspan?

Beh per farlo dovrò dare al codice del sottotitolo un colspan con numero uguale a quello della riga,per esempio:

<td class="title" colspan="2">SOTTOTITOLO COLONNA 1</td>
<td class="title">SOTTOTITOLO COLONNA 2</td>
</tr>

<tr title="RIGA1">
<td class="ww" colspan="2">COLONNA 1</td>
<td class="ww" >COLONNA 2</td>
</tr>

Spero vi sia chiaro^^

Posto altri esempi di colspan con relativo codice sotto spoiler:

COLSPAN SU INTERA COLONNA
COLONNA UNICA
COLONNA1COLONNA2
 
SPOILER (click to view)
CODICE
<table class="skin_tbl" align="center" cellpadding="0" cellspacing="0"><tr><td class="mleft_top"></td><td><table class="mback" width="100%" cellpadding="0" cellspacing="0"><tr><td class="mback_left"></td><td class="mback_center">

<div class="mtitle">COLSPAN SU INTERA COLONNA</div>

</td><td class="mback_right"></td></tr></table></td><td class="mright_top"></td></tr><tr><td class="mleft"></td><td><table class="mainbg" style="text-align:left;width:100%" cellpadding="4" cellspacing="1">

<tr title="RIGA1">
<td class="ww" colspan="2">COLONNA UNICA</td>
</tr>

<tr title="RIGA2">
<td class="ww">COLONNA1</td>
<td class="aa">COLONNA2</td>
</tr>

</table></td><td class="mright"></td></tr><tr><td class="mleft_bottom"></td><td><table class="msub" width="100%" cellpadding="0" cellspacing="0"><tr><td class="msub_left"></td><td class="msub_center">&nbsp;</td><td class="msub_right"></td></tr></table></td><td class="mright_bottom"></td></tr></table>


COLSPAN SU INTERA COLONNA 2
COLONNA1COLONNA2COLONNA2
COLONNA1
 
SPOILER (click to view)
CODICE
<table class="skin_tbl" align="center" cellpadding="0" cellspacing="0"><tr><td class="mleft_top"></td><td><table class="mback" width="100%" cellpadding="0" cellspacing="0"><tr><td class="mback_left"></td><td class="mback_center">

<div class="mtitle">COLSPAN SU INTERA COLONNA 2</div>

</td><td class="mback_right"></td></tr></table></td><td class="mright_top"></td></tr><tr><td class="mleft"></td><td><table class="mainbg" style="text-align:left;width:100%" cellpadding="4" cellspacing="1">


<tr title="RIGA2">
<td class="ww">COLONNA1</td>
<td class="aa">COLONNA2</td>
<td class="aa">COLONNA2</td>
</tr>

<tr title="RIGA2">
<td class="ww" colspan="3">COLONNA1</td>
</tr>

</table></td><td class="mright"></td></tr><tr><td class="mleft_bottom"></td><td><table class="msub" width="100%" cellpadding="0" cellspacing="0"><tr><td class="msub_left"></td><td class="msub_center">&nbsp;</td><td class="msub_right"></td></tr></table></td><td class="mright_bottom"></td></tr></table>


ROWSPAN


Cos'è?
Semplicemente l'allungamento di una colonna su più righe...per esempio:

TITOLO
COLONNA ALLUNGATACOLONNA CENTRALE 1COLONNA DESTRA
COLONNA CENTRALE 2COLONNA CENTRALE 2
 


Il rowspan è molto simile al cospan...per inserirlo dobbiamo scrivere(senza le virgolette) "rowspan="numero" e posizionarlo dopo "ww" o "aa". Esattamente come col colspan c'è un'accortezza da controllare
Quando metto un rowspan devo assicurarmi che la riga sotto abbia un numero di colonne inferiore di uno a quella del rowspan. Ciò continuerà a valere per tante righe quant'è il numero del rowspan. Mi spiego meglio con qualche esempio:

CODICE
<tr title="RIGA1">
<td class="ww" rowspan="2">COLONNA ALLUNGATA</td>
<td class="aa">COLONNA CENTRALE 1</td>
<td class="ww" >COLONNA DESTRA</td>
</tr>

<tr title="RIGA2">
<td class="ww">COLONNA CENTRALE 2</td>
<td class="ww">COLONNA CENTRALE 2</td>
</tr>

<tr title="RIGA2">
<td class="ww">COLONNA CENTRALE 2</td>
<td class="ww">COLONNA CENTRALE 2</td>
<td class="ww">COLONNA CENTRALE 2</td>
</tr>
[/CODE]

Qui per esempio ho un rowspan 2 quindi nella prima riga avrò una colonna in più rispetto alla seconda ma torneranno 3 nella terza riga

CODICE
<tr title="RIGA1">
<td class="ww" rowspan="3">COLONNA ALLUNGATA</td>
<td class="aa">COLONNA CENTRALE 1</td>
<td class="ww" >COLONNA DESTRA</td>
</tr>

<tr title="RIGA2">
<td class="ww">COLONNA CENTRALE 2</td>
<td class="ww">COLONNA CENTRALE 2</td>
</tr>

<tr title="RIGA2">
<td class="ww">COLONNA CENTRALE 2</td>
<td class="ww">COLONNA CENTRALE 2</td>
</tr>


Qui avevo un rowspan 3 quindi per le due righe successive ho avuto una colonna in meno rispetto alla prima...tutto tornerà normale nella quarta e così via

A questo punto non vi resta che sbizzarrirvi con colspan e rowspan per creare la tabella dei vostri sogni^^

SCROLLBAR

Ecco come inserire la scrollbar ovvero la barra che permettere di scorrere su e giù i contenuti di una cella.
on dovete far altro che inserire dopo <td class="ww"> o <td class="aa">questo codice:

CODICE
<div style="overflow:auto; height:100px;">
TUTTI I CONTENUTI DELLA CELLA QUI
</div>


Dove c'è scritto heught potete variare l'altezza della scroll modificando il valore "100"

DEFINIRE L'ALTEZZA O LA LARGHEZZA DI UNA CELLA

Per definire la larghezza di una cella dovete inserire il seguente codice dopo "ww" o "aa" in modo molto simile al colspan e al rowspan:

CODICE
width="25%"


Un esempio:

CODICE
<tr title="RIGA1">
<td class="ww" width="50%">COLONNA1</td>
<td class="aa" width="50%">COLONNA2</td>
</tr>


Oppure:

CODICE
<tr title="RIGA1">
<td class="ww" width="50%">COLONNA1</td>
<td class="aa" width="25%">COLONNA2</td>
<td class="ww" width="25%">COLONNA3</td>
</tr>


Insomma dovete stare attenti solo che la somma delle percentuali sia 100

La stessa cosa per definire l'altezza,basterà sostituire width con height ma seguire le stesse modalità(la somma 100)

Spero che questo tutorial vi sia utile^^ forza correte a sbizzarrirvi nel creare la vostra tabella dei sogni^^

Se avete qualche problema o qualcosa non vi è chiaro o non riuscite o qualsiasi altro problema postate pure nella sezione "codici html e css" ^^

Buon divertimento xdxd
 
Top
*Giuseppe*
view post Posted on 12/5/2009, 18:14




Grazie Victoria!! una domanda non potresti postare un tutorial del codice per le ultime discussioni sul forum??? io sbaglio qualcosa ma non capisco cosa
 
Top
1 replies since 3/1/2009, 00:38   311 views
  Share