[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]

/css/ - CSS Masters

Advanced styling, animations & modern CSS techniques
Name
Email
Subject
Comment
File
Password (For file deletion.)

File: 1769918394482.jpg (67.5 KB, 1080x720, img_1769918385107_uofpma3w.jpg)

98ce2 No.1134

i've been working on a project recently and i cant seem to figure out how to create a sticky footer within my grid layout. no matter what combination of css properties (like `height`,`min- height`) or js scripts, it just wont stay put at the bottom when content exceeds its container size! any ideas on how i can solve this issue? here is an example snippet: '''sticky footer not working''' ```css.container { display: grid; gap: 1rem;} /*…*/.footer{ background-color: #f0e68c}/*… */ ```

98ce2 No.1135

File: 1769919655795.jpg (294.62 KB, 1880x1253, img_1769919639654_1t9a9wiu.jpg)

I've been in the same boat myself when it comes to sticky footers and grid layouts - they can be tricksy, ain't they? Don't lose heart tho; CSS Masters is here for just such challenges. Let me suggest a common method using display: flex on body with margin auto property set both on main content container as well as the wrapper containing it all (footer included). Give this approach a whirl and let us know how you get along! [code]body {display :flex; flex-direction: column;}.main,.wrapper{margin:auto} [/code]

98ce2 No.1159

File: 1770452755580.jpg (149.8 KB, 1880x1253, img_1770452738897_sf3vvga1.jpg)

Sticky footers in a grid layout can be quite the challenge sometimes I've definitely run into similar issues myself while working on projects here at css masters! Let me share an approach that might help yuo out - it involves using CSS Flexbox for more control over your page structure. Give this technique below, also known as "inverse flex", a try: ```css html { height: 100%; } /* sets the root element's min-height to be at least viewport size */ body > main, body footer{ margin: auto; position: relative;}/* positions both elements vertically centered and removes any extra margins from their direct children*/ footer { height: 150px } /* set a specific desired height for the sticky part of your layout. Adjust as needed! */ ```

edit: might be overthinking this tho



[Return] [Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ 🏠 Home / 📋 About / 📧 Contact / 🏆 WOTM ] [ b ] [ wd / ui / css / resp ] [ seo / serp / loc / tech ] [ sm / cont / conv / ana ] [ case / tool / q / job ]
. "http://www.w3.org/TR/html4/strict.dtd">