I think that probably the debate on Fixed against liquid will never find a definitive word. But now perhaps there's another option: the Progressive Layout. In this article, that is a small extract from the Italian version, we'll see how to easily turn with Javascript a CSS-based layout (fixed or fluid doesn't matter) into a progressive one.
Progressive layout combines the advantages of both fixed and fluid layout: it's a fixed layout under and over certain resolutions, but it's fluid between. In the liquid stage the layout is quite different from the classic fluid layout, since the width and the margins of the layout vary accordingly to the browser width.
Let's see the first example. It's a two column layout which is:
You could easily see the width varying from the ruler on the footer by resizing your browser window. Now, let's see how the example would render with Javascript turned off: it's a classic fixed-width two column layout.
If you see the code of the example and the version without Javascript you'll note that they share the same CSS, and mostly the same markup. The only difference is in one line in the markup, before the closure of the body tag:
</div>
<script type="text/Javascript" src="progLayout.js"></script>
</body>
You could view the source of the script here. It's a very short script, that runs when the HTML of the page has been loaded, but before the page is fully displayed, that triggers the width of the main wrapper of the layout according to the client width. This is done also everytime the browser window is resized. To customize the script, you just have to change the fist line of it:
MakeLayout("container",540,850,1024);
The four paramaters, separated by a comma, indicate in order:
You can view how the progressive version serves a better layout, that is suitable for every resolution instead of being fixed. This is done just by embedding a single Javascript file and setting up four parameters in it. That's the strenght of the script, that can transform almost every layout into a progressive one without changing the CSS. Now, let's see another example.
Guida Progettazione siti webDall'analisi dei requisiti fino allo sviluppo e alla promozione:... |
Guida Pubblicare un sito webLe verifiche fondamentali da effettuare prima del lancio di un nuovo... |
Guida Architettura dell'InformazioneL'Architettura dell'informazione è la disciplina che permette di... |
Ogni settimana, direttamente nella tua e-mail: guide, articoli, tutorial e FAQ su Web Design e grafica per il Web.
Iscriviti alla newsletter
|
|
Corso Google AdWords Base27 Febbraio 2012 a Milano |
|
|
Corso Google AdWords Base28 Marzo 2012 a Roma |