• 博客园logo
  • 会员
  • 周边
  • 新闻
  • 博问
  • 闪存
  • 众包
  • 赞助商
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
向阳光大道勇猛前进吧,了解但不走偏门!
            管理     

多列等高篇

 

    1.table

html:

<div class="container"> 
	<div class="left"> 
		<p>我在左边哦</p>
	</div> 
	<div class="right"> 
		<p>我在右边哦</p>
		<p>我在右边哦</p> 
	</div> 
</div>

css:

.container{ display: table; width: 100%; table-layout: fixed; } 
.left{ display: table-cell; width: 100px; } 
.right{ display: table-cell} 

  

效果图:

 

    2.flex

html:

<div class="container"> 
	<div class="left"> 
		<p>我在左边哦</p>
	</div> 
	<div class="right"> 
		<p>我在右边哦</p>
		<p>我在右边哦</p> 
	</div> 
</div>

css:

.container{ display: flex; } /*align-items: stretch*/
.left { width: 100px; margin-left: 20px; } 
.right { flex: 1;}

  效果图:

 

圣凡无二路,方便有多门。
posted @ 2018-03-03 02:01  优昙陀罗  阅读(176)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2026
浙公网安备 33010602011771号 浙ICP备2021040463号-3