Demonstrate padding 0 is the default in HTML and CSS

Description

The following code shows how to demonstrate padding 0 is the default.

Example


<!-- w w  w .ja va2s  .c o m-->







<html>
<head>

<style type="text/css">
.container{
position: relative;
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;
padding-left: 10px;
background: yellow;
}
</style>
</head>
<body>
<div class="container">
<div class="small">this is a test. <BR/>this is a test. this is a test. this is a test. </div>
<div class="box">this is a test</div>
</div>
</body>
</html>

Click to view the demo

The code above generates the following result.

Demonstrate padding 0 is the default in HTML and CSS
Home »
  HTML CSS Tutorial »
    Layout »
      Padding
HTML CSS Tutorial Padding
Combine negative text-indent and padding-le...
Compare padding, one value, two values, thr...
Demonstrate padding 0 is the default in HTM...
Demonstrate that the element's background i...
Do padding with em value in HTML and CSS
Set padding for four directions separately ...
Set padding-left to 0px for list in HTML an...
Set padding-left to 1.5em in HTML and CSS
Set padding-left to 1cm and padding-right t...
Set padding-top to 2px in HTML and CSS