CSS position:fixed Implementing HTML elements fixed to a location

Source: Internet
Author: User

This article explains the position:fixed implementation of HTML elements to a certain location through an example. Instance div will be fixed in the bottom right corner of the Web page, the main use of CSS position:fixed properties, the need for the Code farmers can refer to.

CSS implementation div Fixed in the bottom right corner of the page instance code:
The effect of pinning an element to the lower-right corner of a webpage is very frequent, such as a button that returns to the top, or an informational cue box, which describes how to use CSS to achieve this effect, as shown in the following code example:

<!DOCTYPE HTML><HTML><Head><title>CSS position:fixed Implementing HTML elements fixed to a location</title><styletype= "Text/css">*{padding:0;margin:0;}Body{Height:1000px;}#footer{position:fixed;background:#eee;Bottom:20px; Right:10px;width:100px;Height:100px;}</style></Head><Body><DivID= "Footer"></Div></Body></HTML>

Run online

The above code implements our requirements, the DIV block can be fixed in the bottom right corner of the page, whether or not to drag the scroll bar.

Original address: http://www.manongjc.com/article/292.html

CSS position:fixed Implementing HTML elements fixed to a location

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.