How to build a website grid with float

Consider the grid design of the website and analyze the individual components. Learn than float is so useful and popular technique of building a first web of mesh of the three streams and footer of your website.


Как построить сетку сайта с помощью float

To explore the grid build the website you need to understand what a «stream». The thread is a site elements, arranged one behind the other. For example, it can be div elements by default are to each other. But the flow can be reconstructed, and change the position of block elements.

Как построить сетку сайта с помощью float

For flow control we use the property float, which can place the block on the left side or the right. In CSS file you need to register:

«name class or» block { float: right/left; }

The only drawback to float is the possibility of «nezianya» one unit to another.

Как построить сетку сайта с помощью float

To avoid nezianya, using clear: both — this property configures the flow block. Specify the width and height as maximum and minimum that a value based on the size of the content (text, images). Margin — set the value of auto to outer margins formed automatically depending on the location of the unit.

Sincefloat can place the blocks in two directions, it is customary to divide the site to the flows — left and right. If the programmer need only two threads, it leaves the left and right float, but if more than two, then he sets up with the help of margin indents. As it happens:

1 thread in the CSS file:

.column1 { float: left; width: 65px; min-height: 50px; margin-right: 9px; // 9px from the Central unit }

Как построить сетку сайта с помощью float2 stream:

.column2 { float: left; // to the left block, but without the «nezianya», as used margin width: 80px; min-height: 50px; }

Как построить сетку сайта с помощью float3 stream:

.column3 { float: right; width: 65px; min-height: 50px; }

Как построить сетку сайта с помощью floatDeal with the basement (.footer):

.footer { clear: both; // wrap on both sides }

Как построить сетку сайта с помощью floatSo with the help of a float we did a grid site consisting of three threads.

Post Comment