CSS constraining #1

Constraining element into its parent

by roge roge

HTML

<div id="parent-1">
	DIV-1 width: 300px; height: 100px;
	<p>Foo bar.</p>
	<p>Foo bar.</p>
	<p>Foo bar.</p>
	<p>Foo bar.</p>
</div>

<div id="parent-2">
	DIV-1 width: 300px; height: 100px;
	<p>Foo bar 2.</p>
	<p>Foo bar 2.</p>
	<p>Foo bar 2.</p>
	<p>Foo bar 2.</p>
</div>

CSS

#parent-1 {
	width: 300px; height: 100px;
	background-color: #aaf;	
	overflow: auto;
}
#parent-2 {
	width: 300px; height: 100px;
	background-color: #faa;	
  // without Overflow
}