Friday, December 23, 2011

overflow: scroll / hidden



<html>
<head>
<style type="text/css">
div.scroll
{
background-color:#00FFFF;
width:150px;
height:100px;
overflow:scroll;
}

div.hidden
{
background-color:#00FF00;
width:150px;
height:100px;
overflow:hidden;
}
</style>
</head>

<body>
<p>The overflow property specifies what to do if the content of an element exceeds the size of the element's box.</p>

<p>overflow:scroll</p>
<div class="scroll">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div>

<p>overflow:hidden</p>
<div class="hidden">You can use the overflow property when you want to have better control of the layout. The default value is visible.</div>
</body>
</html>

Tuesday, December 20, 2011

text-overflow:ellipsis/clip with white-space:nowrap;


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css">
div.test
{
white-space:nowrap;
width:12em;
overflow:hidden;
border:1px solid #000000;
}
</style>
</head>
<body>

<p>The following two divs contains a long text that will not fit in the box. As
you can see, the text is clipped.</p>

<p>This div uses "text-overflow:ellipsis":</p>
<div class="test" style="text-overflow:ellipsis;">This is some long text that will not fit in the box</div>

<p>This div uses "text-overflow:clip":</p>
<div class="test" style="text-overflow:clip;">This is some long text that will not fit in the box</div>

</body>
</html>