i want fixed div carry text and bottom, when scroll remain fixed css
- User
i want fixed div carry text and bottom, when scroll remain fixed css
- Assistant
To achieve the desired effect, you can use CSS position:fixed property. Here is a simple example:
HTML:
CSS:
.fixed-text { position: fixed; bottom: 0; width: 100%; background: #FFF; padding: 10px; box-shadow: 0 -2px 6px 0 rgba(0, 0, 0, 0.1); }
.content { height: 1000px; /* height of the content / padding-bottom: 50px; / height of the fixed div / / other styles for the content */ }
Explanation:
We have created two divs, one with class "fixed-text" and the other with class "content". The "fixed-text" div is fixed to the bottom of the page using position:fixed property. It has a width of 100% and a background color of white. We have also added some padding and a box-shadow for a better look.
The "content" div contains the main content of the page. We have given it a height of 1000px (you can replace it with the height of your actual content) and added a padding-bottom of 50px (height of the fixed div) to prevent the content from being overlapped by the fixed div.
This will keep the "fixed-text" div fixed to the bottom of the page even when you scroll up or down.