user3295389
user3295389

Reputation:

Can I insert content before the Body closing tag using CSS?

My problem is that I cannot edit the actual HTML code of my page, I can only style it using CSS. I am using Abode Muse for this website, so the HTML files are overwritten every time I publish a change in Muse.

I need to insert this code right before the closing body tag:

{module_contentholder, name="_SliderScripts"}

Can I select the closing tag of an element in CSS? I have been trying the :before and :after tags but just don't know how to select a closing tag.

I am fairly new to CSS and appreciate any help! Sorry if this is a noob question

Upvotes: 0

Views: 2609

Answers (6)

Sudhir Joil
Sudhir Joil

Reputation: 1

<!DOCTYPE html>
<html>
<head>
<style>
body::after { 
content:"Copyright 2020";
background-color: black;
color:white;
font-weight: bold;
}
</style>
</head>
<body>
<p>My name is Sudhir</p>
<p>I live in Badlapur</p>
</body>
</html>

Upvotes: 0

creativated
creativated

Reputation: 211

you can try this widget for adobe muse that let you place the code before closing body tag or after opening body tag. http://creativated.com/free-muse-widgets-themes/free-adobe-muse-widgets/advanced-html-injector-widget-for-adobe-muse/

from creativated.com

Upvotes: 0

Neido
Neido

Reputation: 181

I couldn't see an answer here that really provides what you need.

As I understand it - Muse is not letting you add this code in the Muse template before you publish?

A Quick search turned up this library which claims to be able to add the function you need into Muse.

http://www.aidbc.com/muse-widgets Download here: http://www.aidbc.com/muse-widgets/insert-bc-content-holder

Please reply to let others know if this was the solution you needed.

Upvotes: 0

Robert K. Bell
Robert K. Bell

Reputation: 10184

Building on cscott's answer, you could use jQuery to append the contents of a contentholder to anywhere in the page, but any quote marks inside the contentholder will not be escaped, and will mess up the .append() function.

More reliably, put your content in a new html page† - one not generated by Muse, so it will not be overwritten. Then use jQuery's .get() function to pull that content and insert it into the page.

Here's an example snippet; it would have to go into the Page Properties › Metadata dialog within Muse:

jQuery(document).ready( function() {
    jQuery.get('/your/content.html', function( data ) {
        // Content has been retrieved, now insert it into the page.
        jQuery('body').append( data );
    });
});

Note I'm using jQuery() and not $() - Business Catalyst's built-in scripts cause trouble when trying to use the shorter form.

† Also, ensure that page is explicitly set to not use any template.

Upvotes: 0

Ansyori
Ansyori

Reputation: 2835

try use some css trick

body:after{
content:'{module_contentholder, name="_SliderScripts"}';
}

Upvotes: 0

cscott
cscott

Reputation: 286

Do you have any access to jQuery or javascript files? Or just the CSS?

The quickest way is to use the jQuery .append() method, which inserts the specified content as the last child of an element. In this case, you'd want to try:

$( "body" ).append( "{module_contentholder, name='_SliderScripts'}" );

More the .append() method here: https://api.jquery.com/append/

Upvotes: 0

Related Questions