div中left的参数除了px像素类型以外 有没有别的了?

来源:百度知道 编辑:UC知道 时间:2024/05/31 10:47:21
如题,能不能设置为相对于窗口大小的类型,因为如果设置为像素定位的话,那么如果改变系统的分辨率,那么就会改变现有的网页的布局了.
没人能解决?
怎么按照百分比啊 能给个例子么?

以下是我写的,写了注释,复制下来直接运行就行了。

<!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>用百分比左右两例布局</title>
<style type="text/css">
*{
margin:0;
padding:0;
}

body{
font-size:75%;/*75%差不多相当于13px大小,在IE6里面文字如果是用px做的单位那么就不能通过浏览器菜单改变文字大小*/
margin:auto;
text-align:center;/*如果没有写文档声明,这行就很用用了*/
}

#wrap{
width:90%;
text-align:left;
margin:auto;
background:#eee;
}

#right{
float:right;
width:62%;
background:#ddd;
height:50