css左右布局,左侧固定,右侧自适应
实现布局的几种方法,见代码:
<!DOCTYPE html>
<html lang="cn">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.content{
width: 100%;
height: 50px;
border: solid 1px;
margin-top: 10px; }
.content div:first-child{
background: red;
height: 50px;
width:50px;
}
.content div:last-child{
background: green;
height: 50px;
}
</style>
</head>
<body>
<!--浮动-->
<div class="content" >
<div style="float: left;"></div>
<div style="margin-left: 50px;"></div>
</div>
<!--绝对定位-->
<div class="content" >
<div style="position: absolute"></div>
<div style="overflow:hidden;"></div>
</div>
<!--flex-->
<div class="content" style="display:flex;">
<div ></div>
<div style="flex-grow: 1"></div>
</div>
<!--表格-->
<table class="content" style="border-collapse: collapse;">
<tr>
<td style="width:50px;background:red;"></td>
<td style="background:green;"></td>
</tr>
</div>
</body>
</html>
css左右布局,左侧固定,右侧自适应的更多相关文章
- html布局,左侧固定右侧自适应
前几天看到我们的UI稿,要实现左侧固定树结构,右侧自适应.想着自己写过几次但是每次都会忘记,在这里做个笔记. 第一种方法: <!DOCTYPE html> <html lang=&q ...
- flex左右布局 左边固定 右侧自适应
flex左右布局 左边固定 右侧自适应 想要保证自适应内容不超出容器怎么办. 通过为自适应的一侧设置width: 0;或者overflow: hidden;解决. 首先实现标题的布局,也很简单: &l ...
- 七种CSS左侧固定,右侧自适应两栏布局
一 两栏布局基本HTML和CSS 首先创建基本的HTML布局和最基本的样式. 基本的样式是,两个盒子相距20px, 左侧盒子宽120px,右侧盒子宽度自适应 <div class="w ...
- css布局中左侧固定右侧自适应
float 单一层浮动法左侧固定成100px; 则核心代码 左侧:width:100px;float:left; 右侧 width:auto;margin-left:100px;绝大浏览器是没有任何问 ...
- css中左侧固定,右侧自适应
谈谈我开始出来工作时候的一道面试题吧 当初我记得在太平洋网络面试的时候,面试官给我出了这么一道题: 有一个外层的div 中间有左右两个div 要求左侧的div 1.只告诉你宽度; 2.只告 ...
- css布局之左侧固定右侧自适应布局
参考代码如下: <form id="form1" style="height:100%; overflow:hidden;"> <div st ...
- CSS左侧固定右侧自适应
方法一: float + margin.left{ float: left; width: 100px; }.right {margin-left:100px; } /*清除浮动*/ .contain ...
- 一个简单的左侧固定右侧自适应demo
<!DOCTYPE html><html> <head> <meta charset="utf-8" /> <title> ...
- CSS自适应布局(左右固定 中间自适应或者右侧固定 左侧自适应)
经常在工作中或者在面试中会碰到这样的问题,比如我想要个布局 右侧固定宽度 左侧自适应 或者 三列布局 左右固定 中间自适应的问题. 下面我们分别来学习下,当然我也是总结下而已,有如以下方法: 一: 右 ...
- css左侧固定宽度右侧自适应
左侧固定宽,右侧自适应屏幕宽: 左右两列,等高布局: 左右两列要求有最小高度,例如:200px;(当内容超出200时,会自动以等高的方式增高) 要求不用JS或CSS行为实现: 仔细分析试题要求,要达到 ...
随机推荐
- c# 解释器模式与sping.net表达式的结合应用(金融里经常需要用到公式,这个公式是抽象的需要自己解释)
.代码 using Spring.Expressions; using System; using System.Collections.Generic; using System.Linq; usi ...
- (深搜)棋盘问题 -- poj -- 1321
链接: http://poj.org/problem?id=1321 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2889 ...
- mysql下的常见问题处理
1. ubuntu中启动mysql,提示mysql access denied for user root@localhost 错误. 是因为还没有给添加的root账户配置密码信息. (1)停止mys ...
- handsontable 概述
很像excel的jquery插件.关于它的中文资料不多,自己只能看看英文的了.记录如下: developer guide //主要是这八部分数据绑定:renderer, afterchange, se ...
- Jenkins启动Tomcat时提示Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
Jenkins构建提示: [SSH] executing...Neither the JAVA_HOME nor the JRE_HOME environment variable is defi ...
- PostgreSQL查询数据(连接查询和子查询)
原料 --用户表 create table "SysUser"( "UserId" serial, --用户Id,自增 "UserName" ...
- jQuery限制文本框的输入长度
jQuery限制文本框输入,包含粘贴. //限制文本框的输入长度 $(function () { $(document).on("keypress", ".txt-val ...
- 记录一下显示Map<String, ArrayList<String>>中的ArrayList里的数据的操作
1.有以下数据: ArrayList<Employee> emp = new ArrayList<>(); emp.add(new Employee("zhang&q ...
- 数据库工具SQLite Expert Personal的简单使用
官方网站: sqliteexpert官方网址 - SQLite administration | SQLite Expert 先使用SQLite Expert Personal熟悉SQLite语句 插 ...
- Programmatically Disable Event Firing on List Item Update in SharePoint 2010
1. Microsoft.SharePoint.dll Create EventFiring.cs 1.Right-click on the project, select Add and click ...