Cookbook template
Note: This is a template page for a CSS Cookbook page. Please use this as a raw template when you create a new cookbook page. Comment in italics are information about how to use part of the template.
Description of the problem this recipe solves or the pattern you are demonstrating.
Requirements
What does this pattern need to include, or what problems does it need to solve? List that here.
Recipe
Change the example code. The last parameter is the live example height, which you can change as needed. Mention that you can click "Play" in code blocks to edit the example in the MDN Playground.
<div class="container">
<div class="item">I am centered!</div>
</div>
.container {
border: 2px solid rgb(75 70 74);
border-radius: 0.5em;
height: 200px;
display: flex;
align-items: center;
justify-content: center;
}
.item {
border: 2px solid rgb(95 97 110);
border-radius: 0.5em;
padding: 20px;
width: 10em;
}
Choices made
Explain your decisions when creating the pattern. Why did you choose a certain method? If you want to add an additional example here — for example a version with fallbacks, please do. This section is deliberately loose as patterns range from the very simple to more complex.
Useful fallbacks or alternative methods
If there are useful alternative methods for building the recipe, or fallback recipes to use if you have to support non-supporting browsers, include them in separate sections down here.
Accessibility concerns
Include this is there are any specific things to watch out for in regard to accessibility. If not relevant for your pattern this can be omitted.
See also
- Links of link of related properties:
example-property
- Links to article showing how to use the property in context: "Using … article"
- Very good external links. Don't be afraid of external links, but they should be outstanding, and not only mention minor details.