Looping the Triangle
Exercise from Eloquent JS, but I turned it into a TriForce from LOZ.
by db_dev
HTML
<div class="triforceContainer">
<ul class="hashContainer">
</ul>
<div class="triangle-container">
<ul class="hashContainer">
</ul>
</div>
<div class="triangle-container">
<ul class="hashContainer">
</ul>
</div>
</div>
CSS
body {
text-align: center;
}
.triforceContainer {
background: #000000;
padding: 50px 0;
outline:solid 1px red;
width:400px;
}
.triangle-container {
display: inline-block;
text-align: center;
}
ul,li {
list-style-type: none;
padding:0;
margin:0;
color: #ffd051;
}
JavaScript
var hashSign = "";
for (var i = 0; i <= 7; i++) {
hashSign = hashSign + "##";
$(".hashContainer").append("<li>" + hashSign + "</li>");
}