Switch to full style
HTML code examples
Post a reply

static vs fixed div position

Thu Nov 10, 2011 2:22 am

static vs fixed div position , static position is the default and it is not affect by top,left,right,bottom properties ,you can change position to fixed in coming example to see the difference.
Code:
<!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>
    <
meta http-equiv="content-type" content="text/html; charset=utf-8" />
    <
title>static postion of div</title>
    <
style type="text/css" media="Screen">
* .
mainDiv {
  
 
  
background#FFCC33;
}

*.
divstatic {
  
position: static;
  
background#EE4C77;
  
padding-left50px;
  
top:30px;
  
right:5px;
  
margin-top:30px;
  
margin-right50px;
  
margin-bottom50px;
 
}
</
style>
</
head>
<
body>
<
div class="mainDiv">Positioned div
  
<div class="mainDiv">Non-positioned div 
    
<div class="divstatic" >static postioned div</div

  </
div
</
div
</
body>
</
html>

 




Post a reply
  Related Posts  to : static vs fixed div position
 difference between a static and a non-static inner class     -  
 Fixed Space Using imageTTFbbox()     -  
 simple example for fixed image     -  
 (3.0.4) Skymiles Setting Fixed WIDTH     -  
 Fixed Quantity Inventory model Simulator (C++)     -  
 Static Import     -  
 What is a static method     -  
 Static Methods and Variables     -  
 Class static properties     -  
 static variable defined in function     -