ciao! ho guardato un altro link interessante,
http://www.dynamicdrive.com/style/layouts/
dove sono riportati vari css per layout fluidi. è utile per studiarci su.
Posto il codice di uno di questi, e anticipo la mia perplessità:
mi è tutto più o meno chiaro tranne una cosa: perchè sia alla colonna di destra che a quella di sinistra imposta float:left, e al footer imposta clear:left???. Impostando float:left vuol dire che l'elemento va a sinistra e gli altri elementi alla sua destra, giusto? ma la colonna di destra sta a destra!! non dovrebbe essre float:right? Ho provato però ad impostare la colonna di destra con float:right e accade che essa si sovrappone al footer. Se invece lascio entrambe float:left e imposto footer clear:both, accade che la colonna di sinistra è più corta di quella di destra.
Insomma, ovviamente il codice è giusto...ma qualcuno sa spiegarmi qualcosa in merito?
grazie moooltisssssimo!
Ecco il CSS di un classico layout fluido 3 colonne con header e footer (non metto anche tutto l'html sennò è lungo..):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Dynamic Drive: CSS Liquid Layout #3.3- (Fluid-Fluid-Fluid)</title>
<style type="text/css">
body{
margin:0;
padding:0;
line-height: 1.5em;
}
b{font-size: 110%;}
em{color: red;}
#topsection{
background: #EAEAEA;
height: 90px; /*Height of top section*/
}
#topsection h1{
margin: 0;
padding-top: 15px;
}
#contentwrapper{
float: left;
width: 100%;
}
#contentcolumn{
margin: 0 15% 0 20%; /*Margins for content column. Should be "0 RightColumnWidth 0 LeftColumnWidth*/
}
#leftcolumn{
float: left;
width: 20%; /*Width of left column in percentage*/
margin-left: -100%;
background: #C8FC98;
}
#rightcolumn{
float: left;
width: 15%; /*Width of right column in pixels*/
margin-left: -15%; /*Set margin to that of -(RightColumnWidth)*/
background: #FDE95E;
}
#footer{
clear: left;
width: 100%;
background: black;
color: #FFF;
text-align: center;
padding: 4px 0;
}
#footer a{
color: #FFFF80;
}
.innertube{
margin: 10px; /*Margins for inner DIV inside each column (to provide padding)*/
margin-top: 0;
}
</style>
<script type="text/javascript">
/*** Temporary text filler function. Remove when deploying template. ***/
var gibberish=["This is just some filler text", "Welcome to Dynamic Drive CSS Library", "Demo content nothing to read here"]
function filltext(words){
for (var i=0; i<words; i++)
document.write(gibberish[Math.floor(Math.random()*3)]+" ")
}
</script>