You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Online

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

#103704 page background and CSS

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by Ryan on Thursday, 02 April 2020 09:47 BST

aklisiewicz
If I have Article1 and Article2 and need to use different page backgrounds I would want to use some CSS, right ?
How can I change page background for specific article ?

When I try to enter a CSS in the code Tab JCE converts itno a content

Ryan
If I have Article1 and Article2 and need to use different page backgrounds I would want to use some CSS, right ? How can I change page background for specific article ?
It's not actually possible to do this from within the editor, without additional HTML too, for example, to apply a background colour to the editor content, you would need to do something like:

<div style="background-color:#eee;">
// you content here
</div>
But this is a bit clunky, as how it looks in the front-end will depend on how the article is rendered by article manager and template. You will need to fiddle a bit to get this right. Also, you would ideally want to use a css class from your template instead of inline css, eg:

<div class="background-red">
// you content here
</div>
then in your template stylesheet, you could have:

.background-red {
    background-color: #cc0000;
    color: #fff;
}
Another way to do this is to use the itemid of the article (this is a number assigned to the article based on its menu assignment), so you can create a css rule in your template stylesheet targeting a sepecific article, eg:

.itemid-279 .item-page [itemprop="articleBody"] {
    background-color: #eee;
    padding: 1em;
}

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.