Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

Kenny Parewijck
Kenny Parewijck
4,602 Points

Why can't I add css code like html here in the post forms?


Look at this:

I paste a piece of html code in here:

    <p>a piece of code</p>

As you can see it comes in a nice black background and is proper indented. But if I paste a piece of css in here like this:

ul {

Then you can see it is shown as pure text and not in a proper view like my html code.

i saw a lot of other questions on this community and with these other post i can see that their css code is also shown in a good way, backgrounded, indented, ..

Do I have to do something or set a preference for my posts in order to be able to post css code in a good view?


3 Answers

I just amended your post to show the css code block. Edit your post to see the changes I made.

You'll note that your html did not show up in total - only a small part shows - you need to use the backticks to segment the block properly. Again, you can see what I amended in your post if you edit it. Try it - remove my edits and see the difference with your html.


Hey Kenny,

If you want the syntax highlighting to activate for some code you're posting, you have to wrap the code with 3 backticks (```). Sometimes, the syntax highlighting correctly guesses what programming language you're using but most of the time, you also want to declare the name of the programming language after the first group of backticks. Also, you need to have a new line before and after your code β€” it looks like this:


.a-css-declaration {



Kenny Parewijck
Kenny Parewijck
4,602 Points

Allright! Helpfully.