Footers not Working as Expected

So I have tried to change the background color of my sales invoice, using footers.

But it will not change it. I can do it to each line (which looks terrible) but not the whole thing.

Here is my code:

The one that works is:

Here is a screenshot of the second code looks like:

I have tested the first code else where (in a different program)
and it shows up as a solid red background,
which is what I am trying to do with this code.

Try this code

<div style="border: 1px solid #000; padding: 10px; background-color: limegreen;">
    This is an inline-styled div with a lime green background.
</div>

1 Like

But what I am trying to do is make all of the invoice a background color of my choice.

I did try your code and it looks a little better at least

like this?

Footer Code

<script>
    var divElement = document.getElementById('printable-content');
    if (divElement) {
        var parentDiv = divElement.parentElement;
        parentDiv.style.backgroundColor = "red";
    }
</script>


4 Likes

Yes thank you!
I had learned on a online course,
but they didn’t show me how to do it that way.

Thank You for the simple and clever solution. I understand that JS manipulates the ID tag β€˜printable-content’ parentDiv. But, would like to know, where did you get the name of the ID tag from. I would like to style the other tags, like table header, total etc, but missing the exact ID, class names.

Right Click page, and select Inspect from ContextMenu

1 Like