On an inline-block element, a positive value in margin-top expands the height of the line and a negative value shrinks it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.container{
width: 800px;
height: 800px;
background: pink;
}
* .box {
float: right;
overflow: auto;
visibility: visible;
width: auto;
height: 100px;
margin: 10px;
padding: 10px;
background: red;
}
* .small {
position: absolute;
margin-top: 10%;
background: yellow;
}
</style>
</head>
<body>
<div class="container">
<img class="small" src="http://www.java2s.com/style/logo.png" alt="star"/>
</div>
</body>
</html>
Related examples in the same category