Search code examples
cssprettifygoogle-code-prettify

Prettify Custom Theme Code does not fit


On certain browsers (Firefox, in this case), the size of a given font is different, which prompted me to download a copy of a theme (desert) from the Google Code page and tweak it myself since the theme had a different background color from my website and I wanted to change the background color of the theme to fit that of my website. However, this version of the theme creates a border around the assumed code area, unlike when I used the online version. I was able to fix the color issue, but I would very much like to remove the border.

I would embed the image, but I am not allowed to since I do not yet have 10 reputation on StackOverflow.

Image below from Firefox (which had the worst case of code overflow)

http://i1164.photobucket.com/albums/q570/SparenofIria/ScreenShot2015-01-19at21732PM_zps0541bc46.png

If someone could direct me to a solution, that would be greatly appreciated. Thank you.

EDIT: The border is filling to the size of the div.

Below are the contents of desert.css. The only things that have been changed from the version I found online are the background colors (#333 to #FFF).

/* desert scheme ported from vim to google prettify */
pre.prettify { display: block; background-color: #FFF }
pre .nocode { background-color: none; color: #000 }
pre .str { color: #ffa0a0 } /* string  - pink */
pre .kwd { color: #f0e68c; font-weight: bold }
pre .com { color: #87ceeb } /* comment - skyblue */
pre .typ { color: #98fb98 } /* type    - lightgreen */
pre .lit { color: #cd5c5c } /* literal - darkred */
pre .pun { color: #fff }    /* punctuation */
pre .pln { color: #fff }    /* plaintext */
pre .tag { color: #f0e68c; font-weight: bold } /* html/xml tag    - lightyellow*/
pre .atn { color: #bdb76b; font-weight: bold } /* attribute name  - khaki */
pre .atv { color: #ffa0a0 } /* attribute value - pink */
pre .dec { color: #98fb98 } /* decimal         - lightgreen */

/* Specify class=linenums on a pre to get line numbering */
ol.linenums { margin-top: 0; margin-bottom: 0; color: #AEAEAE } /* IE indents via margin-left */
li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8 { list-style-type: none }
/* Alternate shading for lines */
li.L1,li.L3,li.L5,li.L7,li.L9 { }

@media print {
  pre.prettify { background-color: none }
  pre .str, code .str { color: #060 }
  pre .kwd, code .kwd { color: #006; font-weight: bold }
  pre .com, code .com { color: #600; font-style: italic }
  pre .typ, code .typ { color: #404; font-weight: bold }
  pre .lit, code .lit { color: #044 }
  pre .pun, code .pun { color: #440 }
  pre .pln, code .pln { color: #000 }
  pre .tag, code .tag { color: #006; font-weight: bold }
  pre .atn, code .atn { color: #404 }
  pre .atv, code .atv { color: #060 }
}

Solution

  • By adding !important;, the css now works. Thanks to those who helped, but in the end I just didn't look around hard enough/forgot that !important; existed.

    pre.prettyprint {
      border: none !important;
    }