dante
dante

Reputation: 37

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. My HTML looks like this:

<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>

And my CSS looks like this:

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

Upvotes: 1

Views: 110

Answers (1)

Michael Coker
Michael Coker

Reputation: 53674

It's kind of unclear what your code is trying to do, you have broken HTML and CSS in just about everything. 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.

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

Upvotes: 5

Related Questions