How to change default CSS styling from HTML blocks?

  • Version 3.18.1
  • Environment production
  • Database mysql
  • Mail SMTP
  • Theme Casper, Version 3.0.12

I’m trying to embed some Plotly graphs into my blog pages. It works really nicely with injecting some Javascrip code into the certain Ghost blog page and also loading the plotly.js min library in the <head> section of the same page.
However, it seems that the Plotly buttons are decorated with my basic settings for URL tags, like a black underscore which becomes blue while hover over. This is the default behaviour of my theme I guess.

Please see the screenshot above, I hope the decoration is evident.
How to override this basic styling in my custom HTML block as below:

<div id="myDiv" style="width:100%;height:450px;"></div>

and the Javascript which generates the 3D graph is this:

    Plotly.d3.csv('', function(err, rows){
function unpack(rows, key) {
  return { return row[key]; });
var z_data=[ ]

var data = [{
           z: z_data,
           type: 'surface'
var layout = {
  title: 'Mt Bruno Elevation',
  autosize: false,
  width: 500,
  height: 500,
  margin: {
    l: 65,
    r: 50,
    b: 65,
    t: 90,
Plotly.newPlot('myDiv', data, layout);

By default the Plotly plot buttons should be without underscore. (I’m sorry that I can’t place another image for better understanding, as I am new to Ghost forum.)

In code-injection header try:

<style> .myDiv a { text-decoration: none; } </style>

@jeff, thanks for this. It seems still not work, even the CSS style is applied, if I understand well from the inspection window.

What can be the reason that the new style is still not applied?

The CSS is using a class selector. If you want to style myDiv, it would need an ID selector like:

#myDiv a {
    text-decoration: none;

Or you can style using a class:

.js-plotly-plot a {
    text-decoration: none;
1 Like

thanks for your reply @minimaluminium , correct, I swapped the class and id selectors, …however it is still not working, so any effect. I tried with !important as well but the same.
What else can override this property?

Hmm, really not sure about that without looking at it first. Can you please send me a live URL to your site, so I can take a look at it?

Sure, I appreciate it. This will lead you there:

Thanks for the link, it really helped! The lines were actually box-shadow, not text-decoration :sweat_smile:

You can remove them with this CSS.

.js-plotly-plot a,
.js-plotly-plot a:hover {
    box-shadow: none;
1 Like

Thank you, this works perfectly :wink: …I wouldn’t arrived alone, …now I can return to build some nice content in my Ghost blog :slight_smile:

1 Like