Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I get a transparent background, while still having Syntax Highlighting?

Picture of the highlighted code on my website

So basically, I’m trying to make the code block the same color as the background (In this case white), while still keeping the colors on the code.

What I’ve Tried

I’ve tried overriding the theme’s CSS rules by creating a new CSS file, inserting the following, and pointing to it in the HTML document:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.reveal pre code {
    display: block;
    padding: 5px;
    overflow: auto;
    max-height: 400px;
    word-wrap: normal;
    background: #FFFFFF;
    color: #DCDCDC;
}

But the background still stayed the same as the theme I was using. (Agate)

Any and all help is appreciated, thank you. I’m new to Highlight JS, so please forgive if I made any mistakes.

>Solution :

Try this CSS:

 .reveal pre code, .hljs {
    background-color: #FFFFFF !important; 
    color: #DCDCDC; 
    padding: 5px;
    overflow: auto;
    max-height: 400px;
    word-wrap: normal;
}
.reveal pre, .hljs {
    box-shadow: none !important;
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading