width:100%的div,分左右两栏,如何控制窗口缩小时div不换行
时间:2011-04-02
来源:互联网
HTML code
样式如上,
窗口一缩小右边的div就自动跑到下面来了,如何解决?
上层的top加确定宽度可以解决,但是我需要占满屏幕的。
调一天了,郁闷 ~~~~~~~
<!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>无标题文档</title> <style> *{margin:0;padding:0;} .top{width:100%;height:25px; } .top .left{margin-left:200px;float:left;height:25px;width:350px;border:1px solid red;} .top .right{width:440px;height:25px;float:right;border:1px solid red;} </style> </head> <body> <div class="top"> <div class="left">左边的</div> <div class="right">右边的</div> </div> </body> </html>
样式如上,
窗口一缩小右边的div就自动跑到下面来了,如何解决?
上层的top加确定宽度可以解决,但是我需要占满屏幕的。
调一天了,郁闷 ~~~~~~~
作者: misadancer 发布时间: 2011-04-02
不明白你要实现什么效果
不过如果固定top right的位置可以么?
.top .right{
width:440px;
height:25px;
float:right;
border:1px solid red;
position:absolute;
top:0px;
left:600px;
}
不过如果固定top right的位置可以么?
.top .right{
width:440px;
height:25px;
float:right;
border:1px solid red;
position:absolute;
top:0px;
left:600px;
}
作者: freewinter 发布时间: 2011-04-02
里面2个div的宽度用 百分比自适应 2个百分比加起来不要超过100 基本就不会换行了
如果要强制左边的宽度的话 那就建议你用 table 简单方便
如果要强制左边的宽度的话 那就建议你用 table 简单方便
作者: KK3K2005 发布时间: 2011-04-02
引用 2 楼 kk3k2005 的回复:
里面2个div的宽度用 百分比自适应 2个百分比加起来不要超过100 基本就不会换行了
如果要强制左边的宽度的话 那就建议你用 table 简单方便
里面2个div的宽度用 百分比自适应 2个百分比加起来不要超过100 基本就不会换行了
如果要强制左边的宽度的话 那就建议你用 table 简单方便
++
将两个DIV放入到只有一行两列的table里
作者: yhtapmys 发布时间: 2011-04-02
.top用100%,它是以窗口为参考,当窗口缩小到<内层所有width之和,当然换行了,
如果内层为float,第一列定义margin-left,IE中实际值是翻倍的,前面间隔可用div代替
注意border是要算入width,改成这样:
HTML code
如果内层为float,第一列定义margin-left,IE中实际值是翻倍的,前面间隔可用div代替
注意border是要算入width,改成这样:
HTML code
<style> *{margin:0;padding:0;} .parent{width:auto;} .top{width:994px; height:25px; clear:both;} .top .marginleft{width:200px; float:left;} .top .left{float:left;height:25px;width:350px;border:1px solid red;} .top .right{width:440px;height:25px;float:right;border:1px solid red;} </style> </head> <body> <div class="parent"> <div class="top"> <div class="marginleft"></div> <div class="left">左边的</div> <div class="right">右边的</div> </div> </div> </body>
作者: xmlife 发布时间: 2011-04-02
CSS code
设置body X轴拖动条自动,winth 和min-width相同试试。
body{overflow:auto} .top{width:100%;height:25px; } .top .left{margin-left:200px;float:left;height:25px;min-width:350px;width:350px;border:1px solid red;} .top .right{min-width:440px;width:440px;height:25px;float:right;border:1px solid red;}
设置body X轴拖动条自动,winth 和min-width相同试试。
作者: mumubangditu 发布时间: 2011-04-02
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28