Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

实现左右两栏布局, 两栏登高的几种方法 #154

Open
zhanhongtao opened this issue Jan 15, 2015 · 2 comments
Open

实现左右两栏布局, 两栏登高的几种方法 #154

zhanhongtao opened this issue Jan 15, 2015 · 2 comments
Labels

Comments

@zhanhongtao
Copy link
Owner

No description provided.

@zhanhongtao
Copy link
Owner Author

padding-bottom + margin-bottom

.wrap {
  overflow: hidden;
}

.side,
.main {
  padding-bottom: 1000em; /* 够使用即可 */
  margin-bottom: -1000em;
}

实例

使用辅助元素

.wrap {
  position: relative;
  overflow: hidden;
}
.sideHelper,
.mainHelper {
  position: aboslute;
  left: 0;
  top: 0;
}
.sideHelper {
  z-index: 2; /* 覆盖 .mainHelper */
  width: 200px; /* $sideWidth */
  background-color: #faa;
}
.mainHelper {
  width: 100%;
  background-color: #f1f1f1;
}

/* 其他内容的 z-index 要高于 helper 元素 */

实例

Flex 子元素拉伸

没什么代码, 直接看实例吧!

display: table/table-cell;

table 标签里面的 td 就是等高的. 看实例

其它

使用一个颜色分割的两栏背景图片.

@zhanhongtao zhanhongtao removed the todo label Jan 19, 2015
@zhanhongtao
Copy link
Owner Author

riskers/blog#2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant