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

by Leonid Solomein #6

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions center/h_stretch/h_stretch-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Centering. Table.</title>
<style>
body
{
margin: 0 30px;
color: #fff;
font: 18px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}

h1
{
margin: 0 0 .5em;
font-size: 1.5em;
}

.table
{
position: absolute;
top: 0;
display: table;
height: 100%;
}

.table_cell
{
display: table-cell;
vertical-align: middle;
}

.block
{
padding: 30px;
background: #006de1;
}
</style>
</head>
<body>
<div class="table">
<div class="table_cell">
<div class="block" contenteditable>
<h1>Table</h1>
Editable...
</div>
</div>
</div>
</body>
</html>
46 changes: 46 additions & 0 deletions center/w_h_fixed/w_h_fixed-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Centering. Negative margins.</title>
<style>
body
{
margin: 30px 0 0;
color: #fff;
font: 18px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}

h1
{
margin: 0 0 .5em;
font-size: 1.5em;
}

.block
{
position: absolute;
top: 50%;
left: 50%;
overflow-y: auto;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin-top: -150px;
margin-left: -150px;
padding: 30px;
width: 300px;
height: 300px;
background: #006de1;
text-align: center;
}
</style>
</head>
<body>
<div class="block" contenteditable>
<h1>Negative margins</h1>
Editable...
</div>
</body>
</html>
47 changes: 47 additions & 0 deletions center/w_h_fixed/w_h_fixed-2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Centering. Absolute.</title>
<style>
body
{
margin: 30px 0 0;
color: #fff;
font: 18px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}

h1
{
margin: 0 0 .5em;
font-size: 1.5em;
}

.block
{
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow-y: auto;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin: auto;
padding: 30px;
width: 300px;
height: 300px;
background: #006de1;
text-align: center;
}
</style>
</head>
<body>
<div class="block" contenteditable>
<h1>Absolute</h1>
Editable...
</div>
</body>
</html>
63 changes: 63 additions & 0 deletions center/w_h_stretch/w_h_stretch-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Centering. Pseudo inline block.</title>
<style>
html,
body
{
margin: 0;
height: 100%;
}

body
{
overflow: hidden;
color: #fff;
font: 18px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}

h1
{
margin: 0 0 .5em;
font-size: 1.5em;
}

.block
{
height: 100%;
text-align: center;
}

.block:after
{
display: inline-block;
height: 100%;
content: '';
vertical-align: middle;
}

.block_content
{
display: inline-block;
overflow: auto;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
padding: 30px;
background: #006de1;
vertical-align: middle;
}
</style>
</head>
<body>
<div class="block">
<div class="block_content" contenteditable>
<h1>Pseudo inline block</h1>
Editable...
</div>
</div>
</body>
</html>
47 changes: 47 additions & 0 deletions center/w_h_stretch/w_h_stretch-2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Centering. Translate.</title>
<style>
body
{
overflow: hidden;
margin: 0;
color: #fff;
font: 18px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}

h1
{
margin: 0 0 .5em;
font-size: 1.5em;
}

.block
{
position: absolute;
top: 50%;
left: 50%;
overflow-y: auto;
padding: 30px;
background: #006de1;
text-align: center;
-moz-transform: translate(-50%,-50%);
-ms-transform: translate(-50%,-50%);
-webkit-transform: translate(-50%,-50%);
-o-transform: translate(-50%,-50%);
transform: translate(-50%,-50%);
max-width: 100%;
max-height: 100%;
}
</style>
</head>
<body>
<div class="block" contenteditable>
<h1>Translate</h1>
Editable...
</div>
</body>
</html>
48 changes: 48 additions & 0 deletions center/w_h_stretch/w_h_stretch-3.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Centering. Button.</title>
<style>
body
{
margin: 0;
}

button
{
position: absolute;
top: 0;
width: 100%;
height: 100%;
border: none;
background: none;
}

h1
{
margin: 0 0 .5em;
font-size: 1.5em;
}

.block
{
display: inline-block;
overflow: auto;
padding: 30px;
background: #006de1;
color: #fff;
font: 18px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
}
</style>
</head>
<body>
<button disabled>
<div class="block">
<h1 contenteditable>Button</h1>
Editable...
</div>
</button>
</body>
</html>
59 changes: 59 additions & 0 deletions center/w_h_stretch/w_h_stretch-4.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Centering. Flex.</title>
<style>
html,
body
{
height: 100%;
}

body
{
overflow: hidden;
margin: 0;
color: #fff;
font: 18px/1 "Helvetica Neue", Helvetica, Arial, sans-serif;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-moz-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
-webkit-box-pack: center;
-moz-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
}

h1
{
margin: 0 0 .5em;
font-size: 1.5em;
}

.block
{
overflow: auto;
padding: 30px;
max-height: 100%;
background: #006de1;
text-align: center;
}
</style>
</head>
<body>
<div class="block" contenteditable>
<h1>Flex</h1>
Editable...
</div>
</body>
</html>
Loading