Css 正在尝试添加背景图像吗?
在我的布局中,我有3个页面。xhtml:Top、Body和Footer。这些页面包含在template.xhtml的Css 正在尝试添加背景图像吗?,css,jsf,jsf-2,primefaces,Css,Jsf,Jsf 2,Primefaces,在我的布局中,我有3个页面。xhtml:Top、Body和Footer。这些页面包含在template.xhtml的中 我正在尝试在pagebody.xhtml中添加一个背景图像,但该图像并没有显示在所有区域中 如何在页面的所有区域显示图像 这就是我的努力 template.xhtml <p:layout fullPage="true"> <p:layoutUnit position="north"> <ui:
中
我正在尝试在pagebody.xhtml中添加一个背景图像,但该图像并没有显示在所有区域中
如何在页面的所有区域显示图像
这就是我的努力
template.xhtml
<p:layout fullPage="true">
<p:layoutUnit position="north">
<ui:include src="/template/top.xhtml"/>
</p:layoutUnit>
<p:layoutUnit position="center">
<ui:include src="/template/body.xhtml"/>
</p:layoutUnit>
<p:layoutUnit position="south">
<ui:include src="/template/footer.xhtml"/>
</p:layoutUnit>
</p:layout>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Facelet Title</title>
<style>
body{
background-image: url("#{resource['imagens/background.png']}");
width:100%;
height:100%;
background-repeat: no-repeat;
background-attachment:fixed;
}
</style>
</h:head>
<h:body>
eu sou o body (I'm body)
</h:body>
</html>
body.xhtml
<p:layout fullPage="true">
<p:layoutUnit position="north">
<ui:include src="/template/top.xhtml"/>
</p:layoutUnit>
<p:layoutUnit position="center">
<ui:include src="/template/body.xhtml"/>
</p:layoutUnit>
<p:layoutUnit position="south">
<ui:include src="/template/footer.xhtml"/>
</p:layoutUnit>
</p:layout>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>Facelet Title</title>
<style>
body{
background-image: url("#{resource['imagens/background.png']}");
width:100%;
height:100%;
background-repeat: no-repeat;
background-attachment:fixed;
}
</style>
</h:head>
<h:body>
eu sou o body (I'm body)
</h:body>
</html>
Facelet标题
身体{
背景图片:url(“#{resource['imagens/background.png']}”);
宽度:100%;
身高:100%;
背景重复:无重复;
背景附件:固定;
}
eu sou o body(我是body)
和结果
试试看:
<style>
body{
background-image: url("#{resource['imagens/background.png']}");
}
</style>
身体{
背景图片:url(“#{resource['imagens/background.png']}”);
}
试试看:
<style>
body{
background-image: url("#{resource['imagens/background.png']}");
}
</style>
身体{
背景图片:url(“#{resource['imagens/background.png']}”);
}
正文{
背景图片:url(“#{resource['imagens/background.png']}”);
背景尺寸:封面;
背景重复:无重复;
背景附件:固定;
}
正文{
背景图片:url(“#{resource['imagens/background.png']}”);
背景尺寸:封面;
背景重复:无重复;
背景附件:固定;
}
不错。但是这张图片就像我贴的图片一样,很好。但是图片的开头和我发布的图片一样。请注意回复中的输入错误:“imagens”有一个额外的“n”请注意回复中的输入错误:“imagens”有一个额外的“n”