Html 在Blogger中制作第一张照片作为帖子背景图片
我希望每个帖子都有一个背景,这个背景是帖子的第一张图片。我尝试了以下方法,但无效:Html 在Blogger中制作第一张照片作为帖子背景图片,html,css,blogger,Html,Css,Blogger,我希望每个帖子都有一个背景,这个背景是帖子的第一张图片。我尝试了以下方法,但无效: 您可以对模板进行一些更改。找到具有post-hentry类的div,并在不干扰现有标记的情况下添加以下属性: expr:style='data:post.firstImageUrl ? "background-image: url(" + data:post.firstImageUrl + ")" : ""
您可以对模板进行一些更改。找到具有
post-hentry
类的div,并在不干扰现有标记的情况下添加以下属性:
expr:style='data:post.firstImageUrl ? "background-image: url(" + data:post.firstImageUrl + ")" : ""'
因此,标记看起来像:
<div
class='post hentry uncustomized-post-template'
itemprop='blogPost'
itemscope='itemscope'
itemtype='http://schema.org/BlogPosting'
expr:style='data:post.firstImageUrl ? "background-image: url(" + data:post.firstImageUrl + ")" : ""'
>
您可以对模板进行一些更改。找到具有
post-hentry
类的div,并在不干扰现有标记的情况下添加以下属性:
expr:style='data:post.firstImageUrl ? "background-image: url(" + data:post.firstImageUrl + ")" : ""'
因此,标记看起来像:
<div
class='post hentry uncustomized-post-template'
itemprop='blogPost'
itemscope='itemscope'
itemtype='http://schema.org/BlogPosting'
expr:style='data:post.firstImageUrl ? "background-image: url(" + data:post.firstImageUrl + ")" : ""'
>
保留您的背景变量为其他页面呈现默认背景,并添加css代码以使用标记覆盖正文背景样式,这将重新编辑post中的第一个图像,您可以在小部件外部使用它:
<style type='text/css'>
body {
background: url('<data:view.featuredImage/>');
}
</style>
正文{
背景:url(“”);
}
保留您的背景变量,为其他页面呈现默认背景,并添加css代码,以使用标记覆盖正文背景样式,这将重新编辑文章中的第一幅图像,您可以在小部件外部使用它:
<style type='text/css'>
body {
background: url('<data:view.featuredImage/>');
}
</style>
正文{
背景:url(“”);
}
你能编辑模板吗?是的,我能,但是这个问题面对我,我解决不了。你能编辑模板吗?是的,我能,但是这个问题面对我,我解决不了。我在我的博客上测试了这个问题,它按预期工作。你能给我alink吗?我在我的博客上测试了这个问题,它按预期工作。你能给我alink吗?