I'm trying to style song lyrics that are stored in an unordered list. Each lyric line is contained in a separate list item. I need these lyrics to be displayed in a two-column format and centered. The code below is the closest that I've gotten but I still have not found a viable solution for centering the text. Any help would be greatly appreciated!
h3 {
clear: both;
padding-top: 20px;
}
.phrases.floated {
margin-left: auto;
margin-right: auto;
background-color: #ccc; /* For demo purposes */
width: 600px;
}
.phrases.floated li {
list-style-type: none;
float: left;
}
.phrases.floated li:nth-of-type(2n+1) {
background-color: beige; /* For demo purposes */
clear: both;
margin-right: 20px;
}
/* Flexbox */
.phrases.flexbox {
display: flex;
flex-flow: row wrap;
background-color: #ccc; /* For demo purposes */
width: 600px;
}
.phrases.flexbox li {
list-style-type: none;
flex-basis: calc( 50% - 10px);
text-align: left;
}
.phrases.flexbox li:nth-of-type(2n+1) {
background-color: beige; /* For demo purposes */
text-align: right;
margin-right: 10px;
}
<h3>Phrases Floated</h3>
<ul class="phrases floated">
<li>O beautiful for spacious skies</li>
<li>For amber waves of grain</li>
<li>For purple mountain majesties</li>
<li>Above the fruited plain!</li>
<li>America! America</li>
<li>God shed His grace on thee</li>
<li>And crown thy good with brotherhood</li>
<li>From sea to shining sea!</li>
</ul>
<h3>Phrases Flexbox</h3>
<ul class="phrases flexbox">
<li>O beautiful for spacious skies</li>
<li>For amber waves of grain</li>
<li>For purple mountain majesties</li>
<li>Above the fruited plain!</li>
<li>America! America</li>
<li>God shed His grace on thee</li>
<li>And crown thy good with brotherhood</li>
<li>From sea to shining sea!</li>
</ul>