2017-03-01 96 views
1

我不能让我的背景图像重复垂直使用CSS和HTML。我的HTML看起来像这样:我无法获得背景图像垂直重复与CSS/HTML

<div style="stack"> 
<img src="http://i.imgsafe.org/370409f.png" style="background-repeat:repeat-y; 
width:120px;height:100px;alt="sunflower"> &nbsp 
</div> 
width:120px;height:100px;alt="sunflower"> &nbsp 
</div> 

我的CSS是这样的:

.stack { 
background-image:url(http://i.imgsafe.org/370409f.png) 
background-repeat:repeat-y; 
} 

回答

5

这有点不清楚你的代码是试图做的,你在刚才的一切打破HTML和CSS。你应该通过一个验证器来运行你的代码,它会告诉你所有的事情都被破坏了。但这是一般概念。主要只是将style="stack"更改为class="stack",然后将您的CSS放入CSS文件中,并删除所有已损坏的内联style属性的内容。

.stack { 
 
    background: url(http://i.imgsafe.org/370409f.png) 0 0 repeat-y; 
 
    height: 1000vh; 
 
}
<div class="stack"> 
 
</div>