开发者

How do I get a fixed element to scroll horizontally when the viewport width is smaller than an HTML page width?

开发者 https://www.devze.com 2023-03-17 17:13 出处:网络
Can I get a fixed block element to scroll horizontally without JavaScript or jQuery wizardry? The block after it r开发者_运维问答eaches the top of the viewport has its CSS position changed from absolu

Can I get a fixed block element to scroll horizontally without JavaScript or jQuery wizardry? The block after it r开发者_运维问答eaches the top of the viewport has its CSS position changed from absolute to fixed when the window is scrolled vertically. Is it necessary to construct another set of calculations to determine how to position it when scrolling the page horizontally?

Stack Overflow does this too.

How do I get a fixed element to scroll horizontally when the viewport width is smaller than an HTML page width?


Not possible with pure css.

You will need Javascript.. (i am facing the same problem right now..)

See Centering a fixed element, but scroll it horizontally


I don't really get your question but somehow I think this is what your are looking for: Use CSS @media queries to determine the width of the viewport.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号