Css Getting Started Tutorial: CSS Position tutorial

Source: Internet
Author: User

With the knowledge of CSS positioning, you will be able to manipulate the exact location of HTML elements. Design: JavaScript or HTML image map is used before. Now we can do this in CSS. It is not only easy to code, but it also loads faster!

Relative position
The location of the HTML element relative to the location of the location change usually appears. If we have a title that appears on the webpage above us, we can use relative positioning to move it to a bit of authority and reduce the number of pixels. The following is an example.

H3 {
Position: relative;
Top: 15px;
Left: 150px;
}
P {
Position: relative;
Left:-10px;
}

You may have noticed that you have determined only two possible directions (left, right, top, bottom) (left and top ). Here is a quick move reference to the HTML element in CSS.

Move to left-use a negative value to exit.
Move to the right-use a positive value.
Move up-use a negative value to the top.
Move down-use a positive value with the highest value.

Absolute position
Absolute positioning: The exact pixel value you define will appear in the specified HTML element. The starting point is the visible area of the leftmost browser, so be sure to measure from this point.

Note: Firefox does not currently provide a correct explanation. But these two 6.0 + and Opera 8.0 + are used.

H3 {
Position: absolute;
Top: 50px;
Left: 45px;
}
P {
Position: absolute;
Top: 75px;
Left: 75px;
}
Now the tutorial is OK.

Related Article

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.