Detailed explanation of DIV fixed layer CSS code

Source: Internet
Author: User

The webpage layout now uses DIV + CSS. To make the webpage layout look good, you need to set a fixed position for some DIV layers and scroll without following the browser's scroll bar. For Beginners, setting the CSS code for such a DIV layer is a little difficult. I am also a newbie. I spent some time studying the CSS code. Now I want to share it with the webmaster who needs it, use this CSS style code to set the DIV layer to be fixed anywhere on the page

The code for DIV + CSS is as follows:

<Style> # box {height: 45px;/* height */background: # 488fce;/* background Color */width: 100%;/* width */position: fixed; /* fixed Layer */top: 0px;/* this is the top distance. To set bottom: 0 at the bottom, to show left: Numeric px, right: on the left or right: value: px */filter: alpha (Opacity = 80);-moz-opacity: 0.8; opacity: 0.8; z-index: 100; /* set the transparency of the DIV Layer */} </style> <div id = "box"> <div style = "width: 960px; "> This is a DIV fixed layer </div> <div style =" text-align: center; margin: 30px 0 0 0; "> 

Tip: the code can be modified before running!

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.