Magical "relative" to achieve the location of Web layer position

Source: Internet
Author: User
Web page in the production, we often encounter such a problem: picture resolution once larger, the window to maximize the dislocation of the layer. When you use a menu to insert a layer, the layer is positioned relative to its ancestor, and once you move it, it immediately becomes an absolute position. This problem is small, but in the actual application process will still bring some trouble to the web designer.

In fact, the core of the layer dislocation is the problem of the parent layer and the child layer. As long as the parent layer is positioned relative to a point, and the child layer is positioned relative to the parent layer, the target of the relative positioning of the layer can be achieved.

Insert a table inside the page (you can center it), click inside a cell, and then insert a layer through the menu, which is positioned relative to the cell. After inserting a layer, do not move it, and never move, but you can change its size, such as its height and width are changed to "0", so that it no longer affect your edits to other content, otherwise, this layer of "left" and "top" attributes appear after the absolute positioning. If it becomes an absolute position, you can remove its "left" and "top" attributes and revert to relative positioning. After becoming "0", sometimes the child layer will not be visible, you can press the "F11" key point it resumes editing. Now the cursor should be flashing inside this layer, then inserting the child layer through the menu, where the child layer overlaps with the parent layer, and you can move it at will.

No matter how it moves, it is positioned relative to the parent layer. So the problem is solved. Be careful not to move the left and top properties, however, because it is positioned relative to the upper left-hand corner of the parent.

Tip: First insert a table, insert the parent in one of the cells, you can make it smaller, such as 20 pixel wide, 10 pixels high, so that it will not cover the link below, and does not affect the relative positioning of the child layer. If you want to define a table in 778 pixel widths, you can insert the parent layer into the first cell in the first row of the table so that you can insert the parent layer after all the layers have been made!

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.