Skip to content

Commit

Permalink
feat: 增加适用类别
Browse files Browse the repository at this point in the history
  • Loading branch information
toBeTheLight committed Mar 13, 2018
1 parent d8cb3c6 commit 5487f3a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# 水平垂直居中

- [lineheight](http://yanhaijing.com/vertical-center/lineheight.html)
## 仅居中元素定宽高适用:
- [absolute + 负margin](http://yanhaijing.com/vertical-center/absolute1.html)
- [absolute + margin auto](http://yanhaijing.com/vertical-center/absolute2.html)
- [absolute + calc](http://yanhaijing.com/vertical-center/absolute3.html)

## 居中元素不定宽高适用:
- [absolute + transform](http://yanhaijing.com/vertical-center/absolute4.html)
- [writing-mode](http://yanhaijing.com/vertical-center/writing-mode.html)
- [lineheight](http://yanhaijing.com/vertical-center/lineheight.html)
- [table](http://yanhaijing.com/vertical-center/table.html)
- [css-table](http://yanhaijing.com/vertical-center/css-table.html)
- [writing-mode](http://yanhaijing.com/vertical-center/writing-mode.html)
- [flex](http://yanhaijing.com/vertical-center/flex.html)
- [grid](http://yanhaijing.com/vertical-center/grid.html)
- [grid](http://yanhaijing.com/vertical-center/grid.html)
2 changes: 1 addition & 1 deletion absolute1.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</head>
<body>
<div class="wp">
<div class="box">123123</div>
<div class="box size">123123</div>
</div>

<div class="question">
Expand Down
2 changes: 1 addition & 1 deletion absolute2.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</head>
<body>
<div class="wp">
<div class="box">123123</div>
<div class="box size">123123</div>
</div>

<div class="question">
Expand Down
2 changes: 1 addition & 1 deletion absolute3.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</head>
<body>
<div class="wp">
<div class="box">123123</div>
<div class="box size">123123</div>
</div>

<div class="question">
Expand Down
5 changes: 4 additions & 1 deletion common.css
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
}

.box {
background: green;
}

.box.size{
width: 100px;
height: 100px;
background: green;
}

.question {
Expand Down
4 changes: 3 additions & 1 deletion writing-mode.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
.wp-inner {
writing-mode: horizontal-tb;
display: inline-block;
text-align: left;
text-align: center;
width: 100%;
}
.box {
display: inline-block;
margin: auto;
text-align: left;
}
</style>
</head>
Expand Down

0 comments on commit 5487f3a

Please sign in to comment.