Upload
ariel-francis
View
214
Download
1
Embed Size (px)
Citation preview
Technologies for web publishing
Ing. Václav Freylich
Lecture 6
aTNPW1-6
Content
CSS layouts Flexible three column layout
aTNPW1-6
What is the idea?
We want to create the layout with two fixed side columns and one fexible column in the centre.
When resize the window the content box size is changed. The header and footer width is changed. The side boxes aren’t changed
Menu
Header
Submenu,voting, news, …
Footer
Main content box
aTNPW1-6
Four possible situations
1)
3)
2)
4)
aTNPW1-6
Four possible situations
1) and 2)One of the sidebars is longer than the content box
3)Content box is longer than sidebars
4)Content box is shorter than sidebars
In all described situations we need to keep the footer at the bottom!
aTNPW1-6
Solution - the floating boxes
1. Mark the boxes with numbers (numbers are the order of boxes in HTML code)
2. The order of the boxes 2 – 4 – 3 is important !3. Boxes 2 and 3 are floating !
2
1
3
5
4
aTNPW1-6
HTML code
Put the boxes into the HTML code according their order
<div id=“layout”><div id=“header”>Header text</div><div id=“menu”>Menu items</div><div id=“right”>Voting, news, …</div><div id=“content”>Main content</div><div id=“footer”>Footer content</div>
</div>
aTNPW1-6
CSS style
Create the CSS style definitions
#header { width: 100%; height: 50px; background-color: blue;}
#menu { width: 150px; height: 350px; background-color: red;float: left; }
#right { width: 150px; height: 250px; background-color: yellow;float: right; }
#content {color: red;}
#footer {clear: both; background-color: green;}