12 layout elements: Layouts and typography

Source: Internet
Author: User

The browser uses streams to decorate the XHTML elements on the page. The browser starts at the beginning of the XHTML file and follows the flow of elements from start to finish to show each element it encounters.

When the browser is going to display two inline elements side-by, the boundary between the two elements is the sum of the two element boundaries. When the browser places two block elements in parallel, the common boundary overlaps together, and the height of the overlapping boundary is the value of the maximum boundary.

The Float property allows an element to be left or right as far as possible (CSS only allows elements to drift to the right or left).

Drift can be used to provide Web page columns, can be divided into the following steps to do. 1. Use the ID to give a name to the element to drift. 2. To drift it under which element, be sure to move its xhtml behind that element. 3. Set the width of the element. 4. Drift the element to the left or right. The clear element allows elements to flow into the page without allowing drift elements to appear on the left, right, or both sides of the element.

The boundary of the drift element does not intersect with the boundaries of the elements in the normal flow, so they do not overlap.

Freeze the size of the layout frozen page, the browser width when the appearance of significantly worse.

The gel layout locks the width of the content area in the page, but places them in the center of the browser.

Absolute layout, the browser removes the element completely from the stream, and the browser places the element in the position indicated by the top and right properties (can also be used with bottom and left; You can also use PX to specify the position as a percentage). Unlike drift elements, elements in a stream need to adjust their line contents to take into account the boundary of the drift element. However, absolute layout elements have no effect on other elements. The Z-index property can be used to specify the stacking position. You cannot use the clear property at this time to avoid element overrides.

Comparison of various layouts 1. Drift layout: With the Float property, the footer with the clear property, the only problem is that the content placement order is changed.

2. Gel layout, use a fixed size <div> to surround all the contents of the page to create a frozen layout, and then use the "Auto" attribute value to allow the boundary expansion to make the gel layout. The disadvantage of this approach is that the content does not expand as the browser window transforms.

3. Absolute layout Absolute elements cannot be used with the clear attribute and cannot avoid element overrides

In general, drift in multi-column layouts is considered to be the most flexible solution. Note the order of the content.

Specifying the position of an element using a fixed arrangement is the same as using an absolute arrangement, but this position offsets the edge of the browser window rather than the page.

Unlike the absolutely arranged and fixed arrangement, the relative arrangement of elements is still part of the page flow, but at the last minute the browser offsets its position before the element is displayed. The relative arrangement is a little bit like static arrangement, and slightly added a bit of absolute layout. Relative placement is defined as an offset relative to the actual position, rather than the absolute parallelism of the most recently contained block.

12 layout elements: Layouts and typography

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.