A paragraph with top and bottom margins set at 5% : margin top « CSS « HTML / CSS






A paragraph with top and bottom margins set at 5%

  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Box Model Demo</title>
<meta http-equiv="Content-Type"
  content="text/html; charset=iso-8859-1" /> <style type="text/css">

body {
  background-color: #808;
}
p {
  background: #c0c; 
  margin-left: 20%; 
  padding-left: 10%;
  margin-top: 5%;
  margin-bottom: 5%;
}

</style> </head>
<body>
     <p>A paragraph with top and bottom margins set at 5%</p>
   
</body>
</html> 

   
  








Related examples in the same category

1.'margin-top' Example
2.Margin with four directions
3.margin-top: 2px;
4.margin-top: .33em
5.Set image margin top and left to negative value
6.Independently set margin-left, margin-right, margin-top, and margin-bottom.
7.Layered with negative top margin
8.Top Aligned Absolute block
9.Top offset Static Block