Jump to content

CSS code not working on single page code injection

Recommended Posts

Site URL: https://mushroom-sapphire-grdc.squarespace.com/

(This code will allow a little outer glow around a specific image:)
 
If I put it in Design>Custom CSS, and it works, but I am trying to put page specific code on their respective pages to try to organize a bit better:
 
#block-yui_3_17_2_1_1596655451516_4134 {.image-overlay {box-shadow: 0px 0px 10px 4px (#fff);}}
 
How do I translate this code to a single blog page where I am either suppose to inject it into either the "Page Header Code Injection” area or the "Post Blog Item Code Injection
I thought it would be this but it is not working:
 
<style>
#block-yui_3_17_2_1_1596655451516_4134 {.image-overlay {box-shadow: 0px 0px 10px 4px (#fff);}}
</style>
 
Any thoughts?
 
Thanks in advance,
Link to comment
  • Replies 10
  • Created
  • Last Reply

Top Posters In This Topic

That bloc id is for a specific image, Custom css applies it to all pages, so the one with the block will work, but if you post it in the header of any single page, it will not. This means you need to target the image block id put it in the code and apply the code to the page the image is on. You can id specific blocks with a free Chrome plug in:  https://chrome.google.com/webstore/detail/squarespace-id-finder Once you id the block just change it in your code insert in the header of the page you want. 

Edited by derricksrandomviews
Link to comment

Thanks Derrick,

That is the plug-in I used to id the block.  Like I said previously, it works when added to Design>Custom CSS, but I am not sure how to write it if I just wanted to add it to the Page Header Code Injection area of my blog page instead of the Design>Custom CSS area.

Edited by David_Ledger
Link to comment

I appreciate you reaching out.  I originally put everything in the Design>Custom CSS area.  I was hoping to tidy up the site by moving CSS that only effected single pages pages over to the Code Injection areas.  No worries, it still works in the Custom CSS area.  Thank you!

 

Link to comment
  • 3 months later...

My code injection doesn't work on mobile devices on Product pages my client website. Stop working yesterday. I didn't have the problem before. Thank you for your help.
Please check this page. I can't rate the product and write review on iPhone, any mobile device. I test it both browsers Google and Safari on mobile and it doesn't work. 

I am using Facebook Comment Plugin code and Rating-Widget code in code injection and code blocks.

https://www.newdaywholehealth.com/essential-oils/eaters-digest

https://www.newdaywholehealth.com/essential-oils/brain-power

Edited by lstrauss831
Link to comment
On 12/5/2020 at 1:52 AM, lstrauss831 said:

My code injection doesn't work on mobile devices on Product pages my client website. Stop working yesterday. I didn't have the problem before. Thank you for your help.
Please check this page. I can't rate the product and write review on iPhone, any mobile device. I test it both browsers Google and Safari on mobile and it doesn't work. 

I am using Facebook Comment Plugin code and Rating-Widget code in code injection and code blocks.

https://www.newdaywholehealth.com/essential-oils/eaters-digest

https://www.newdaywholehealth.com/essential-oils/brain-power

Hi. Have you solved this yet?

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

Link to comment
  • 9 months later...

@tuanphan Hi, I'm having the same issue. I've entered CSS to change the background color of store and product page, however, on mobile and incognito, the background does not show up on page load (once I reload, it appears; have had it tested on other phones and same problem.)

Site URL: https://www.delicatehammerstudio.com/tributary-collection

Password is DHVIP2021

And the custom code used on this specific page's Page Header Code Injection is below:

<style>
.Main {
background-color: #212931 !important;
}
</style>

I've also tried applying the CSS to the site, targeting the specific store pages—this solves the loading problem for the store pages, but is NOT applying the background color to all product pages within that store. That code used is here:

body#collection-6094f797c91c8270768fdbf7 .Main {
    background: #ffffff !important;

Link to comment
3 hours ago, delicatehammer said:

I've entered CSS to change the background color of store and product page, however, on mobile and incognito, the background does not show up on page load

As you're using a Brine family template, you should only add your styles to Design > Custom CSS. Your site's template uses Ajax Page Loading to improve performance (read more) and so you should not add styles using Code Injection. They'll only load whilst you're logged on; visitors won't see them (except on refresh).

Regarding store pages, they'll have a collection class (prefix with ".") not a collection ID (prefix with "#"), so your CSS would start with:

body.collection-6094e977b128ae3b58601c3b

 

About me: I've been a SQSP User for 18 yrs. I was invited to join the Circle when it launched in 2016. I have been a Circle Leader since 2017. I don't work for Squarespace. I value honesty, transparency, diversity and good design ♥.
Work: I founded and run SF.DIGITAL, building Squarespace Extensions to supercharge your commerce website. 
Content: Views and opinions are my own. Links in my posts may refer to SF.DIGITAL products or may be affiliate links.
Forum advice is free. You can thank me by clicking one of the feedback emojis below. Coffee is optional.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.