The CSS property position: fixed has become widely popular due to its ability to provide developers with precise control over element positioning o...
For further actions, you may consider blocking this person and/or reporting abuse
For a full-screen overlay, you can use
inset
instead ofbottom
,top
,left
andright
:do you know to style 3 section styled by grid and 2 section from the 3 are postion fixed. is there a way ? like I have 2 sidebar on the left and the right and in the middle not fixed contnent what is best approach to style this site
If you have the following markup:
... you can make the
<aside>
-tags sticky and the<main>
scrollable with this CSS:The
10rem
are the widths of the<aside>
-tags.stacky not fixed?
Yes,
sticky
will behave likefixed
when the value specified intop
is reached.nice, thank you . how can I improve myself in html&css, I trid to strat from scratch again learn css grid css flex and built 6 or 7 side project but after 1 month I forget everything I learned.
Just keep going ... experience is key!
when I saw your code I said oh that make sence or that clever but when I think in differnt projects my solution bad I just use alot of padding margin and media queries .
nice
I would always use
position: absolute
for setting the position of a child of a parent. You'll get a lot more control with absolutely positioned children.As long as the parent has a position anything but static, the child will automatically take it's position and height from the parent.
Great
It seems like the case you outlined (and the 3rd limitation) are solved in a more "purpose-built" way by
position: sticky
? Or am I missing something?We need to adapt to the situation. When applied to an element, position: sticky allows it to behave like both a position: relative and a position: fixed element, depending on its position relative to the viewport. When we have multiple sections that are scrolling then position sticky can be very tricky.
However, it's always important to consider browser compatibility and ensure that the feature is supported across the targeted platforms and versions.
Thank you🙂