实现一个div,左边固定div宽度200px,右边div自适应
<div class= "container">
<div class="left"></div>
<div class="rigth"></div>
</div> <style>
/*方法一: BFC(块级格式化上下文)*/
.container{
width:1000px;height:400px;border: 1px solid red;
}
.left{
width:200px;height:100%;background: gray;
float: left;
}
.rigth{
overflow:hidden; /* 触发bfc */
background: green;
} /*方法二: flex布局 */
.container{
width:1000px;height:400px;border:1px solid red;
display:flex; /*flex布局*/
}
.left{
width:200px; height:100%;background:gray;
flex:none;
}
.right{
height:100%;background:green;
flex:1; /*flex布局*/
} /* 方法三: table布局 */
.container{
width:1000px;height:400px;border:1px solid red;
display:table; /*table布局*/
}
.left{
width:200px; height:100%;background:gray;
display:table-cell;
}
.right{
height:100%;background:green;
display: table-cell;
} /*方法四: css计算宽度calc*/
.container{
width:1000px;height:400px;border:1px solid red;
}
.left{
width:200px;height:100%;background:gray;
float:left;
}
.right{
height:100%;background:green;
float:right;
width:calc(100% - 200px);
}
</style> ---------------------------------------------------------------------------------------------------
<div style="width:100%;height:auto;overflow:hidden">
<div style="float:left;width:200px;height:auto;min-height:300px;background:#f00">左边固定宽度</div> <div style="margin-left:200px;width:100%">右边撑满剩余宽度</div>

实现一个div,左边固定div宽度200px,右边div自适应的更多相关文章

  1. NO.14 两个div并排,左边为绝对宽度,右边为相对宽度

    两个div并排,左边为绝对宽度,右边为相对宽度,这个问题,我也经常遇到,我一般的处理方法是将最大的容器padding-left固定宽度,左边的固定宽度的一块position:absolute,然后ri ...

  2. css网页布局 --- 左边固定,右边自适应

    div的布局统一如下: <body> <div class="wrap"> <div class="left"></d ...

  3. DIV+CSS布局问题:一个宽度不确定的DIV里面放三个水平对齐的DIV,左右两个DIV宽度固定为150px,中间那个DIV充满剩余的宽度

    一个入门的DIV+CSS布局问题:一个宽度不确定的DIV里面放三个水平对齐的DIV,左右两个DIV宽度固定为150px,中间那个DIV充满剩余的宽度. 说明:代码非真实情况下使用,所以直接简单. 没耐 ...

  4. 实现左边div固定宽度,右边div自适应撑满剩下的宽度的布局方式:

    html: <div class="container"> <div class="left"> left固定宽度200px </ ...

  5. 设置一个DIV块固定在屏幕中央(两种方法)

    设置一个DIV块固定在屏幕中央(两种方法) 方法一: 对一个div进行以下设置即可实现居中. <style> #a{ position: fixed; top: 0px; left: 0p ...

  6. 实现三个div,固定左右两边的div宽为200,中间的div宽度自适应的四种方法

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  7. div左边固定宽度,右边自适应宽度

    样式: <style type="text/css"> html,body { height: 100%; padding: 0; margin: 0; } .oute ...

  8. CSS 左边div固定,右边div自适应

    有时候我们会有这样的需求,如图,aside是导航或者某些链接,右边的main是显示重要的内容,左边需要定宽,右边的main能够自适应剩余的宽度: <!DOCTYPE html PUBLIC &q ...

  9. css实现左边div固定宽度,右边div自适应撑满剩下的宽度

    (1)使用float <div class="use-float"> <div></div> <div></div> & ...

随机推荐

  1. Linux排序命令sort详解

    语法格式sort [ -A ] [ -b ] [ -c ] [ -d ] [ -f ] [ -i ] [ -m] [ -n ] [ -r ] [ -u ] [ -o OutFile ][ -t Cha ...

  2. 【C】——可变参数

    写代码之前要先介绍一下可变参数的备用知识: C函数要在程序中用到以下这些宏: void va_start( va_list arg_ptr, prev_param ); type va_arg( va ...

  3. 修改Windows和linux系统时间

    1.修改本机Windows的系统时间,Java代码实现: import java.io.IOException; import java.text.SimpleDateFormat; import j ...

  4. 解决android studio上“com.android.dex.DexIndexOverflowException: method ID not in [0, 0xffff]: 65935”问题

    我是在更换应用的一个jar包时发生的这个错误,网上查到说是因为同时在工程中引入了多个第三方jar包,导致调用的方法数超过了android设定的65935个(DEX 64K problem),进而导致d ...

  5. Visual Studio的Debugger Visualizers

    在英文网站上找到一份清单,列出了Visual Studio的Debugger Visualizers,觉得很好,记下来备注并分享: ASP, WEB:ASP.NET control graph vis ...

  6. 使用VMware将Linux装在物理硬盘上,开机即可进入Linux (转)

    目录(?)[-] 本文目的 具体操作 1 软件准备 2  安装 21 对硬盘操作 22 创建虚拟机并安装 23 使用Grub引导Linux 1. 本文目的 适合于没有光驱的计算机来安装Linux,还有 ...

  7. error: navicat 连接debian系列系统mysql 10038问题解决方案

    还特么有一种可能 阿里云 也有防火墙出口入口规则,这里也有问题

  8. Numpy的array数组和标量之间的运算

    矢量化 数组很重要,因为它使你不用编写循环即可对数据执行批量运算.这通常就叫做矢量化(vectorzation) 数组与数组的运算 数组与标量的算术运算

  9. WEB打印(jsp版)

    <%@ page contentType="text/html; charset=UTF-8" language="java"%> <%@in ...

  10. (笔记)Linux Socket通信:bind: Address already in use

    在网络通信时使用Bind绑定IP地址跟端口号时,有时Ctrl+C强制结束进程之后,再次运行程序Bind错误,原因如下: 虽然用Ctrl+C强制结束了进程,但错误依然存在,用netstat -an |g ...