I am struggling with applying different CSS styles to the odd and even divs in my code. The current implementation I have does not seem to be working as expected. I specifically want the styling to target only the direct children of the div, rather than any nested elements within the div.
.work-layer {
display: flex;
justify-content: center;
flex-direction: column;
color: white;
height: 100%;
}
.work-container:nth-child(odd) {
text-align: right;
padding-right: 100px;
}
.work-container:nth-child(even) {
text-align: left;
padding-right: 100px;
}
.name {
font-size: 3em;
text-transform: uppercase;
}
.desc {
font-size: 1.75em;
width: 40%;
}
.url {
font-weight: bold;
font-size: 1.5em;
color: white;
}
.work-layer {
height: 300px;
}
.layer-textastic {
background-color: rgba(0, 133, 255, 1);
}
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700,800" rel="stylesheet">
<div class="work">
<div class="work-container textastic">
<div class="work-layer layer-textastic">
<h1 class="name">Textastic</h1>
<p class="desc">I made this website as an homage to a great little text editor for iOS known as Textastic</p>
<a href="#" class="url">jordanbaron.me/Updated-Textastic-Site</a>
</div>
</div>
</div>