Home>Article>Web Front-end> How to fix css3 elements without scrolling
In CSS3, you can use the position attribute to fix the element without scrolling. This attribute is used to specify the positioning type of the element. When the value of the attribute is set to fixed, the position of the element is fixed relative to the browser window. Position, you can achieve non-scrolling, the syntax is "element {position:fixed;}".
The operating environment of this tutorial: Windows 10 system, CSS3&&HTML5 version, Dell G3 computer.
In css, you can use the position positioning attribute to fix the position of the div on the page
The position attribute specifies the positioning type of the element.
Elements can be positioned using the top, bottom, left and right attributes. However, these properties will not work unless the position property is set first. They also work differently, depending on the positioning method.
fixed Positioning
The position of the element is a fixed position relative to the browser window.
Fixed positioning, positioning relative to the creation of the browser, you can use the four attributes top, right, bottom, and left to define the position of the element relative to the browser window. Using fixed positioning elements, the position of the element remains fixed no matter how you scroll the browser window.
Examples are as follows:
sergsergsgs
>
Output results:
(Learning video sharing:css video tutorial,html video tutorial)
The above is the detailed content of How to fix css3 elements without scrolling. For more information, please follow other related articles on the PHP Chinese website!