Creating this pattern using <pre>
is straightforward, but I am interested in achieving the same result with <div>
Is it possible to do this with margins?
I attempted to use margins and was able to achieve success, although some patterns proved challenging with this method.
Successfully Completed:-
*********
**** ****
*** ***
** **
* *
* *
** **
*** ***
**** ****
*********
HTML
<div class="pattern">
<div class="space">
*********<br>
****<span style="margin-left: 11%;"></span>****<br>
***<span style="margin-left: 33%;"></span>***<br>
**<span style="margin-left: 55%;"></span>**<br>
*<span style="margin-left: 77%;"></span>*<br>
*<span style="margin-left: 77%;"></span>*<br>
**<span style="margin-left: 55%;"></span>**<br>
***<span style="margin-left: 33%;"></span>***<br>
****<span style="margin-left: 11%;"></span>****<br>
*********
</div>
</div>
CSS
.pattern {
letter-spacing: 10px;
margin: 10px;
display: flex;
font-weight: 700;
font-size: 100%;
}
Desired Implementation
*
* *
* *
* *
* *
* *
* *
* *
*
Snippet
.pattern {
letter-spacing: 10px;
margin: 10px;
display: flex;
font-weight: 700;
font-size: 100%;
}
<div class="pattern">
<div class="space">
*********<br>
****<span style="margin-left: 11%;"></span>****<br>
***<span style="margin-left: 33%;"></span>***<br>
**<span style="margin-left: 55%;"></span>**<br>
*<span style="margin-left: 77%;"></span>*<br>
*<span style="margin-left: 77%;"></span>*<br>
**<span style="margin-left: 55%;"></span>**<br>
***<span style="margin-left: 33%;"></span>***<br>
****<span style="margin-left: 11%;"></span>****<br>
*********
</div>
</div>