Code Example: Implementing CSS Last Child on a Div

To address the issue, two solutions are available. The first one involves the use of nth-child. A sample can be found at Meanwhile, the second option requires you to specify the location and timing for the clear div. You can also opt for nth-child(..) for this solution. In the latter example, the third item follows the “#left” rule (the first one) in the stylesheet and is thus floated to the left.


For updated question:

The selector necessitates some modification, it ought to be adjusted to achieve the desired outcome.

li:last-child .streamBox {
  border: none;

The selector you’re using matches all the children of the parent since

<div class="streamBox">

is both the first and last child. To target only the last


and its


, use


on the


. You can test it here, and I’ve made the border black to highlight the change.

Regarding the previous inquiry, the issue lies in the absence of a quotation mark in the attribute labeled as


. To resolve the problem, simply add the missing quotation mark as shown below.

blah blah
blah blah
blah blah
blah blah

Once you test it here, you’ll see that the first three will have borders and it will function as expected.

Frequently Asked Questions

Posted in Css