This repository accompany various CSS documentation pages on MDN Web Docs. This document will help you get started with contributions!
Note
You can include an example directly in MDN pages using {{EmbedLiveSample()}}
macros or regular Markdown code blocks.
These methods are simpler to maintain as the code lives beside the rest of the content.
Only add examples to this repository if your example doesn't easily run on MDN pages for technical or security reasons.
There are many ways you can help improve this repository! For example:
- Write a new example. If you would like to add a new example, make sure this feature is supported by a stable version of modern browsers.
- Improve an existing example. You could make improvements or add some other changes which would make example more helpful to the users.
- Fix a bug: we have a list of issues, or maybe you found your own.
You will need to have Git and GitHub set up to be able to contribute.
For more information on setting up Git on your machine, read this article. With the above dependencies satisfied, create your new account on GitHub.
Next up, you need to fork and clone the repo to be able to contribute to it. You can learn about forking on GitHub. Once you have your own fork, clone it to your local machine.
You should serve your example locally to see the results before submitting your changes. There are a few different ways to do this depending on your preferred tooling methods. See Running a simple local HTTP server for information on setting up a server.
cd my-cool-example
python3 -m http.server
Once you're satisfied, the final step is to submit your pull request. You can find more information about submitting pull requests in our Community guidelines docs.
After your pull request is reviewed and merged, you can link to your example from MDN Web Docs. For example, the https://mdn.github.io/css-examples/counter-style-demo/ demo is referenced in MDN content like so:
See more examples on the [demo page](https://mdn.github.io/css-examples/counter-style-demo/).
Thanks a lot for your contribution! If you'd like to ask questions or get in touch, feel free to drop by in Discord or say hello in one of our communication channels.