[英]I can't get a background image to repeat vertically with CSS/HTML
I cant get my background image to repeat vertically using CSS and HTML. 我无法使用CSS和HTML垂直重复背景图片。 My HTML looks like this: 我的HTML看起来像这样:
<div style="stack">
<img src="http://i.imgsafe.org/370409f.png" style="background-repeat:repeat-y;
width:120px;height:100px;alt="sunflower">  
</div>
width:120px;height:100px;alt="sunflower">  
</div>
And my CSS looks like this: 我的CSS看起来像这样:
.stack {
background-image:url(http://i.imgsafe.org/370409f.png)
background-repeat:repeat-y;
}
It's kind of unclear what your code is trying to do, you have broken HTML and CSS in just about everything. 不清楚您的代码将要做什么,您几乎破坏了所有的HTML和CSS。 You should run your code through a validator and it will tell you everything that is broken. 您应该通过验证器运行代码,它将告诉您所有损坏的信息。 But here's the general concept. 但这是一般概念。 Mainly just change style="stack"
to class="stack"
and then put your CSS in a CSS file and remove all of the broken inline style
attribute stuff. 主要是将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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.