如何在Squarespace中给定文字层后面的目标背景中添加自定义CSS图像? [英] How do I add a custom CSS image to the target background behind a given layer of text in Squarespace?

查看:151
本文介绍了如何在Squarespace中给定文字层后面的目标背景中添加自定义CSS图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在为Squarespace中的客户定制网站(以便他们可以自己管理)。

We are working on customising a website for our client in Squarespace (so that they can manage it on their own).

我在CSS中添加了CSS样式文字层的背景,但不会显示。我已将图像导入到Squarespace中,并使用了URL。

我还检查了page元素,并找到了要定位的ID。

I've added a CSS style to the background of a layer of text, but it won't show up. I have imported the image to use into Squarespace and I have the URL.
I have also inspected the page element and found the id that I'm wanting to target to.

这是我的代码:

#yui_3_17_2_5_1465050472193_17704 {
  background-image: url("http://static1.squarespace.com/static/55bed56ee4b04fdc6e0dd0d8/t/5752e43c22482e7d77f53e3b/1465050172750/Share+the+Love+Kids+Club.png")
}

为什么这不添加我期望的图像?

Why does this not add the image I expect?

推荐答案

当前,在Squarespace中,以 yui开头的任何ID 都可以/将在页面刷新时更改。这是因为此类ID是动态生成的。因此,您不应在CSS或Javascript中使用它们。

In Squarespace, currently, any ID starting with "yui" can/will change on page refresh. That is because such IDs are dynamically generated. Therefore, you should not rely on them for use in CSS or Javascript.

但是,当前接受的是块ID(ID的以 block-开头不会更改,只要不删除或移动该块以致使其被删除(例如,将文本块直接拖动到另一个文本块上方/下方)即可。

However, it is currently accepted that block IDs (ID's starting with "block-" do not change as long as the block is not removed or moved in a way that causes it to be removed (such as dragging a text block directly above/below another text block).

因此,您应该定位要应用CSS规则的块的块ID;如果您需要定位更高的特异性,请从块ID开始,然后从此处添加特异性。例如:

Therefore, you should instead locate the block ID of the block to which you want the CSS rule applied. If you need to target with even greater specificity, start with the block ID then add specificity from there. For example:

#block-yui_3_17_2_4_1443109442267_11866 {
    background-image: url("http://static1.squarespace.com/static/55bed56ee4b04fdc6e0dd0d8/t/5752e43c22482e7d77f53e3b/1465050172750/Share+the+Love+Kids+Club.png")
}

如果这仍然不足以解决问题,请考虑向该页面添加链接,并说明您想要定位的页面上的ich区块/区域。

If this still doesn't give you enough to get the problem solved, consider adding a link to the page in question, and stating which block/area on the page you want to target.

其他信息/参考:

  • https://answers.squarespace.com/questions/59297/how-do-i-discover-a-block-id.html
  • https://answers.squarespace.com/questions/10450/which-ids-should-i-target-for-my-css.html

这篇关于如何在Squarespace中给定文字层后面的目标背景中添加自定义CSS图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆