开发者

Targeted horizontal overflow

开发者 https://www.devze.com 2023-03-07 13:48 出处:网络
Is there a way to target html elements that I don\'t want to affect the width of the pag开发者_C百科e?

Is there a way to target html elements that I don't want to affect the width of the pag开发者_C百科e? In other words, those elements wouldn't trigger the horizontal scrollbar, if they were to leave the browser box.


You could use the CSS overflow: hidden to keep them from affecting your layout.


You can use overflow:hidden on the elements you don't want the scrollbar on.

You can also use overflow-x:hidden or overflow-y:hidden Reference


Checking other sites structures, the solution seems to be pretty simple:

Wrapping everything in a relative positioned container(with overflow:hidden) lets the container grow with the contents of the page, while not letting the elements show out of it's borders.

Example:

http://jsfiddle.net/LnNQJ/1/

0

精彩评论

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