Forum Moderators: open
In IE I can do 100%-5px for example, but that doesn't work with other browsers and non 100% values.
Anyone have any ideas? Im ideally looking for a solution that will work in IE, Firefox, Opera and Safari, but seperate solutions are also an option. I know, Im not asking much! ;-)
Thanks
Nasdaq
<html><head>
</head>
<body style="margin:0;">
<div style="position:relative;height:100%;width:35%;background-color:teal;float:left;padding:0;">Box 1</div>
<div style="width:4px;height:100%;background-color:silver;float:left;"></div>
<div style="position:relative;height:100%;float:left;">
<div style="height:100%;width:100%;position:relative;background-color:teal;">Box 2</div>
</div>
</body>
</html>
It would be great if someone knows how to get this to work with non IE browsers?
Many thanks!
Nasdaq
</body>
</html>
But make sure you are using a proper doctype, so the modified code would be:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<html><head>
<style type="text/css">
html,body{height:100%}
</style>
</head>
<body style="margin:0">
<div style="height:100%;width:35%;background-color:teal;float:left;padding:0;">Box 1</div>
<div style="height:100%;float:left;">3</div>
<div style="height:100%;width:60%;float:left;background-color:teal;">Box 2</div>
</body>
</html>
At that width, it certainly can't be to put content in. If you only want it for some sort of border effect or something like that then there are much better ways to do it:
<div style="width:40%;background:teal;float:left;">Box one</div>
<div style="width:60%;background:teal;float:left;">
<div style="border-left:silver 5px solid;">Box two</dix>
</div>