Here is the HTML code:
<div class="container">
<div class="scrollable-block">
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
<div class="absolute-div"></div>
</div>
Here is the CSS code:
.container {
width: 200px;
height: 300px;
background: green;
}
.scrollable-block {
width: 200px;
max-height: 250px;
overflow: scroll;
position: relative;
}
.absolute-div {
width: 20px;
height: 20px;
background: purple;
position: absolute;
top: 0;
right: -10px;
}
Check out the live demo here: http://jsfiddle.net/BYTam/1/
The green div serves as the container with a fixed width. The yellow div is nested inside with a max-height and overflow-y: scroll. The goal is to position the purple div absolutely relative to the yellow div, but outside the green div to avoid a horizontal scrollbar in the yellow div. Is this achievable?
Thank you!