我想使用css的background-image prop显示背景图片,仅用于页面的第一行。我怎么能这样做?我用的代码就像;
background-image:url(backgr.png);
background-repeat:x-repeat;
background-position:left top;
但这提供了在所有行中重复图像。
答案 0 :(得分:2)
如果您正在谈论页面的第一行,请考虑制作具有适当高度和宽度的div。你应该将图像放在那里。
<html>
<head>
<style type="text/css">
body
{
background-image:url('yourimage.jpg');
background-repeat:repeat-x;
}
</style>
</head>
<body>
<p>Your text over here</p>
</body>
</html>
答案 1 :(得分:1)
试试这个css:
background:url(backgr.png) repeat-x left top;