tags:

views:

49

answers:

2
+1  Q: 

css, fixed size

Hi, I need three tables (div). The left and right sides of the occupied 50% of the free window. The center is fixed.

Everything seems fine, but right down to jump off the table.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<style type="text/css">
body{
    margin:0;
    padding:0;
}
#left{
    float: left;
    width: 50%;
    background: #FDA02E;
    margin-left: -300px;
}
#center{
    float: left;
    width: 600px;
    margin-right: 300px;
    background: #C8FF98;
}
#right{
    float: left;
    width: 50%;
    margin-left: -300px;
    background: #FDE95E;
}
</style>
</head>
<body>
<div id="pag">
    <div id="left">
        Left
    </div>
    <div id="center">   
        Center
    </div>
    <div id="right">
        Right
    </div>
</div>
</body>
</html>
+2  A: 

I kind of don't see the idea behind that but here is a working version:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<style type="text/css">
body{
    margin:0;
    padding:0;
}
#left{
    float: left;
    width: 50%;
    background: #FDA02E;
}
#center{
    position: absolute;
    width: 600px;
    left: 50%;
    margin-left: -300px;
    background: #C8FF98;
}
#right{
    float: right;
    width: 50%;
    margin-left: -300px;
    background: #FDE95E;
}
</style>
</head>
<body>
<div id="pag">
    <div id="left">
        Left
    </div>
        <div id="center">   
        Center
    </div>
    <div id="right">
        Right
    </div>
</div>
</body>
</html>
Ivo Sabev
+1 nice one. Beat me to it.
Dead account
A: 

This solution gives you no overlap in content. (I've added borders to the side columns to show this).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<style type="text/css">
body{
    margin:0;
    padding:0;
}
#left-wrapper{
    width: 50%;
    float: left;
    margin-right: -600px;
    padding-right: 300px;
}
#left {
    margin-right: 300px;
    background: #FDA02E;
    border: 1px solid black;
}
#center{
    float: left;
    width: 600px;
    margin-right: -300px;
    background: #C8FF98;
}
#right-wrapper{
    width: 50%;
    float: left;
}
#right {
    margin-left: 300px;
    background: #FDE95E;
    border: 1px solid black;
}
</style>
</head>
<body>
<div id="pag">
    <div id="left-wrapper">
        <div id="left">
            Left<br><br>
        </div>
    </div>
    <div id="center">   
        Center<br><br><br><br><br><br><br><br><br><br><br><br>
    </div>
    <div id="right-wrapper">
        <div id="right">
            Right<br><br><br><br>
        </div>
    </div>
</div>
</body>
</html>
cowbellemoo