How to construct a website grid by means of float

How to construct a website grid by means of float

Let's consider a grid design of the website and we will sort separate components. Let's study, than float and also popular reception of creation of the first web grid from three flows and the basement of the website is so useful.

For studying grid creation of the website it is necessary to understand what is ""flow"". The flow is the elements of the website located one after another. For example, it can be div-elements which by default go one after another. But the flow can be rebuilt and to change the provision of block elements. 

For flow control we use float property which can place the block in the left side or right. It is enough to state in the CSS file:

""name of a class or block"" {float: right/left; }

The only lack of float is a possibility of ""nayezzhaniye"" of one block on another. 

To avoid a nayezzhaniye, we use clear: both — it property will configure flow of the block. We set width and height as a maximum and a minimum that the value was formed by the amount of maintenance (the text, images). Margin - we set auto value in order that external indents were formed automatically depending on arrangement of the block. 

So kakfloat can place blocks in two directions, it is accepted to divide the website into flows — left and right. If the programmer needs only two flows, then he leaves the left and right float, but if more than two, then it configures indents by means of margin. As it occurs: 

1 flow in the CSS file:

.column1 {  float: left;  width: 65px;  min-height: 50px;  margin-right: 9px;//on 9px from the central block }2 flow: 

.column2 {  float: left;//to the left block, but without ""nayezzhaniye"" as applied  margin width: 80px;   min-height: 50px; }3 flow: 

.column3 {  float: right;  width: 65px;   min-height: 50px; }We deal with the basement (.footer): 

  .footer {clear: both;//flow on both sides }Here so by means of float we made the grid to the website consisting of three flows. 

Author: «MirrorInfo» Dream Team


Print