Search code examples
cssgithubmarkdown

Custom css file for readme.md in a Github repo


I am having trouble verifying the name of the .css file that will modifying the readme.md file at the root of Github repo.

I believe it is:

.github/github.css

but that doesn't seem to do anything to the Markdown. Does anyone know if this is incorrect?


Solution

  • GitHub does not allow for CSS to affect README.md files through CSS for security reasons (as if you could inject CSS into a ReadMe, you could easily launch a phishing attack). This includes both stylesheets referenced through <link rel> and inline styles used with <style>.

    The readmes are in markdown syntax, so some styling can be done, such as adding colours through placeholder images, just like here on StackOverflow. For example, you can add red squares #f03c15 with the following:

    - ![#f03c15](https://placehold.it/15/f03c15/000000?text=+) `#f03c15`
    

    You can also make use of things like diff, json, html, js and css to affect text colouring.