You can do this with CSS like this:
HTML:
<div class="wrapper">
<div class="inner">
</div>
</div>
CSS:
.wrapper{
width: 400px;
height: 300px;
}
.inner{
max-width: 100%;
overflow-x: hidden;
}
Now your .wrapper
div will have overflow: visible;
but your .inner
div will never overflow because it has a maximum width of 100% of the wrapper div. Note that your wrapper must have an explicitly defined width.
Here is a working jsFiddle
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…