forked from mdn/css-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
236c797
commit 842d72f
Showing
8 changed files
with
329 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<!doctype html> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>CSS Cookbook: center an element</title> | ||
|
||
<link rel="stylesheet" href="styles.css"> | ||
|
||
<style> | ||
.container { | ||
height: 200px; | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
border: 2px solid rgb(75, 70, 74); | ||
border-radius: .5em; | ||
} | ||
|
||
.item { | ||
width: 10em; | ||
border: 2px solid rgb(95, 97, 110); | ||
border-radius: .5em; | ||
padding: 20px; | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<div class="item">I am centered!</div> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!doctype html> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>CSS Cookbook: columns with flexbox, wrapping</title> | ||
|
||
<link rel="stylesheet" href="styles.css"> | ||
|
||
<style> | ||
.container { | ||
border: 2px solid rgb(75, 70, 74); | ||
border-radius: .5em; | ||
padding: 20px 10px; | ||
width: 500px; | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
|
||
.container>* { | ||
margin: 0 10px; | ||
flex: 1 1 200px; | ||
padding: 10px; | ||
border: 2px solid rgb(95, 97, 110); | ||
border-radius: .5em; | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo | ||
melon azuki bean garlic.</p> | ||
|
||
<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard | ||
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p> | ||
|
||
<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea | ||
prairie turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter purslane | ||
fennel azuki bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<!doctype html> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>CSS Cookbook: columns with flexbox</title> | ||
|
||
<link rel="stylesheet" href="styles.css"> | ||
|
||
<style> | ||
.container { | ||
border: 2px solid rgb(75, 70, 74); | ||
border-radius: .5em; | ||
padding: 20px 10px; | ||
display: flex; | ||
} | ||
|
||
.container>* { | ||
margin: 0 10px; | ||
padding: 10px; | ||
border: 2px solid rgb(95, 97, 110); | ||
border-radius: .5em; | ||
flex: 1; | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo | ||
melon azuki bean garlic.</p> | ||
|
||
<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard | ||
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p> | ||
|
||
<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado | ||
daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach | ||
carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin | ||
onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot | ||
carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p> | ||
|
||
<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea | ||
prairie turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter purslane | ||
fennel azuki bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<!doctype html> | ||
|
||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>CSS Cookbook: columns with grid</title> | ||
|
||
<link rel="stylesheet" href="styles.css"> | ||
|
||
<style> | ||
.container { | ||
border: 2px solid rgb(75,70,74); | ||
border-radius: .5em; | ||
padding: 20px; | ||
width: 500px; | ||
display: grid; | ||
grid-template-columns: 1fr 1fr; | ||
grid-gap: 20px; | ||
|
||
} | ||
|
||
.container > * { | ||
padding: 10px; | ||
border: 2px solid rgb(95,97,110); | ||
border-radius: .5em; | ||
margin: 0; | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo melon azuki bean garlic.</p> | ||
|
||
<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p> | ||
|
||
<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea prairie turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter purslane fennel azuki bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<!doctype html> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>CSS Cookbook: columns with multicol</title> | ||
|
||
<link rel="stylesheet" href="styles.css"> | ||
|
||
<style> | ||
.container { | ||
border: 2px solid rgb(75, 70, 74); | ||
border-radius: .5em; | ||
padding: 20px; | ||
column-width: 10em; | ||
column-rule: 1px solid rgb(75, 70, 74); | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<p>Veggies es bonus vobis, proinde vos postulo essum magis kohlrabi welsh onion daikon amaranth tatsoi tomatillo | ||
melon azuki bean garlic.</p> | ||
|
||
<p>Gumbo beet greens corn soko endive gumbo gourd. Parsley shallot courgette tatsoi pea sprouts fava bean collard | ||
greens dandelion okra wakame tomato. Dandelion cucumber earthnut pea peanut soko zucchini.</p> | ||
|
||
<p>Turnip greens yarrow ricebean rutabaga endive cauliflower sea lettuce kohlrabi amaranth water spinach avocado | ||
daikon napa cabbage asparagus winter purslane kale. Celery potato scallion desert raisin horseradish spinach | ||
carrot soko. Lotus root water spinach fennel kombu maize bamboo shoot green bean swiss chard seakale pumpkin | ||
onion chickpea gram corn pea. Brussels sprout coriander water chestnut gourd swiss chard wakame kohlrabi beetroot | ||
carrot watercress. Corn amaranth salsify bunya nuts nori azuki bean chickweed potato bell pepper artichoke.</p> | ||
|
||
<p>Nori grape silver beet broccoli kombu beet greens fava bean potato quandong celery. Bunya nuts black-eyed pea | ||
prairie turnip leek lentil turnip greens parsnip. Sea lettuce lettuce water chestnut eggplant winter purslane | ||
fennel azuki bean earthnut pea sierra leone bologi leek soko chicory celtuce parsley jícama salsify.</p> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<!doctype html> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>CSS Cookbook: sticky footer with flexbox</title> | ||
|
||
<link rel="stylesheet" href="styles.css"> | ||
|
||
<style> | ||
body { | ||
min-height: 100vh; | ||
display: flex; | ||
flex-direction: column; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
.page-header, | ||
.page-footer { | ||
background-color: rgb(75, 70, 74); | ||
color: #fff; | ||
padding: 20px; | ||
flex-shrink: 0; | ||
} | ||
|
||
.page-body { | ||
padding: 20px; | ||
flex-grow: 1; | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body> | ||
<header class="page-header">This is the header</header> | ||
<article class="page-body"> | ||
<div class="item">Main page content here, add more if you want to see the footer push down.</div> | ||
</article> | ||
<footer class="page-footer">Sticky footer</footer> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!doctype html> | ||
|
||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
|
||
<title>CSS Cookbook: sticky footer</title> | ||
|
||
<link rel="stylesheet" href="styles.css"> | ||
|
||
<style> | ||
body { | ||
min-height: 100vh; | ||
display: grid; | ||
grid-template-rows: auto 1fr auto; | ||
} | ||
|
||
* { | ||
box-sizing: border-box; | ||
} | ||
|
||
.page-header, | ||
.page-footer { | ||
background-color: rgb(75, 70, 74); | ||
color: #fff; | ||
padding: 20px; | ||
} | ||
|
||
.page-body { | ||
padding: 20px; | ||
} | ||
</style> | ||
|
||
</head> | ||
|
||
<body> | ||
<header class="page-header">This is the header</header> | ||
<article class="page-body"> | ||
<div class="item">Main page content here, add more if you want to see the footer push down.</div> | ||
</article> | ||
<footer class="page-footer">Sticky footer</footer> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* Some default styling for cookbook examples */ | ||
/* | ||
rgb(53,43,34) | ||
rgb(75,70,74) | ||
rgb(95,97,110) | ||
rgb(137,151,188) | ||
rgb(160,178,226) | ||
*/ | ||
body { | ||
background-color: #fff; | ||
color: #333; | ||
font: 1.2em / 1.5 Helvetica Neue, Helvetica, Arial, sans-serif; | ||
padding: 0; | ||
margin: 0; | ||
} |