I am having trouble applying styles to the final <p>
in a specific div. I would like to achieve this without introducing a new class or ID.
Despite attempting to use the last-child selector, I have not been successful in accomplishing my goal.
I have also experimented with declaring
p:last-child {font-style: italic;}
in my CSS file, but it does not seem to be making any difference.
Below is the HTML code I am working with:
<div class="new-section">
<div class="collection-container">
<div class="container">
<div class="row">
<div class="title span16">
<h1>The Title</h1>
</div>
<div class="span8">
<p>Some text.</p>
<p>This collection includes video, audio and essays.</p>
<p>Visit now</p>
<div class="arrow-right"></div>
</div>
</div>
</div>
</div>
</div>
And this is the LESS CSS code I have written:
.collection-container {
height: 200px;
position: relative;
background-color: @gray;
.container {
padding-top: @r-margin;
.title {
margin-bottom: @xs-margin;
}
.span8 p:last-child {
font-style: italic;
}
}
}