View Single Post
  #1 (permalink)  
Old Oct 29th, 2007, 22:26
google google is offline
Junior Member
Join Date: Oct 2007
Location: hello
Age: 28
Posts: 23
Thanks: 0
Thanked 0 Times in 0 Posts
positioning - relative or absolute?

hi all, im relatively new to web design, only got in to css last week and still learning a lot.

i made my first proper functional site, using fully w3 compliant html and css yesterday, but have been told that my method for positioning divs etc i bad.

the way i do it at the moment, the only way i know how, is using absolute positioning. so my stylesheet is sort of as follows:

Code: Select all
div.logo
{
    border-style: solid;
    border-width: 1px;
    border-color: #3D3D3D;
    position: absolute;
    background: url('../images/topbg.jpg');
    background-repeat: repeat-x;
    text-align: left;
    width: 65%;
    top: 5px;
    left: 17.5%;
    right: 17.5%;
    height: auto;
}

div.topbar
{
    border-style: solid;
    border-width: 1px;
    border-color: #3D3D3D;
    background: url('../images/topbarbg.jpg');
    background-repeat: repeat-x;
    position: absolute;
    width: 65%;
    left: 17.5%;
    right: 17.5%;
    top: 103px;
    height: 24px;
    text-align: right;

}

div.content
{
    background-color: #FFFFFF;
    border-style: solid;
    border-width: 1px;
    border-color: #3D3D3D;
    border-top: none;
    position: absolute;
    top: 129px;
    bottom: 31px;
    width: 65%;
    left: 17.5%;
    right: 17.5%;
    text-align: center;
}

div.content_box
{
    position: absolute;
    top: 1%;
    left: 20%;
    right: 1%;
    bottom: 1%;
    text-align: center;
    overflow: auto;
}
so im setting the absolute positions of everything. i have been told this i bad, and that i should use relative positions, but i just dont understand how. help would be appreciated, thx!
Reply With Quote