<div class="container">
	<div class="item">Item 1</div>
	<div class="item">Item 2</div>
	<div class="item">Item 3</div>
	<hr class="delimiter">
	<div class="item">Item 4</div>
	<div class="item">Item 5</div>
	<div class="item">Item 6</div>
</div>
<form id="changer">
	<label>
		<input type="radio" name="type" value="last-child">
		.item:last-child
	</label>
	<label>
		<input type="radio" name="type" value="not-last-child">
		.item:not(:last-child)
	</label>
	<label>
		<input type="radio" name="type" value="last-of-type">
		.item:last-of-type
	</label>
	<label>
		<input type="radio" name="type" value="not-last-of-type">
		.item:not(:last-of-type)
	</label>
	<label>
		<input type="radio" name="type" value="plus" checked>
		.item + .item
		</label>
</form>
body {
	margin: 0;
	font: 16px 'Segoe UI', Arial, Helvetica, sans-serif;
}

.container {
	padding: 20px;
	display: flex;
	flex-direction: column;
	background: #ecfecf;
}

/* last-child */
.container[data-type="last-child"] .item {
	margin-bottom: 20px;
}

.container[data-type="last-child"] .item:last-child {
	margin-bottom: 0;
}

/* not-last-child */
.container[data-type="not-last-child"] .item:not(:last-child) {
	margin-bottom: 20px;
}

/* last-of-type */
.container[data-type="last-of-type"] .item {
	margin-bottom: 20px;
}

.container[data-type="last-of-type"] .item:last-of-type {
	margin-bottom: 0;
}

/* not-last-of-type */
.container[data-type="not-last-of-type"] .item:not(:last-of-type) {
	margin-bottom: 20px;
}

/* plus */
.container[data-type="plus"] .item + .item {
	margin-top: 20px;
}

.item {
	padding: 10px;
	border-radius: 4px;
	box-shadow: 0 4px 8px -2px rgba(0, 0, 0, 0.25);
	background: #ffffff;
}

.delimiter {
	height: 1px;
	margin: 20px 0;
	border: none;
	background: linear-gradient(to right, transparent, #222222, transparent);
}

#changer {
	position: fixed;
	top: 0;
	right: 0;
	padding: 5px;
	display: flex;
	flex-direction: column;
	font-family: monospace;
	background: rgba(0, 0, 0, 0.6);
	color: #ffffff;
}

#changer label {
	display: flex;
	align-items: center;
}

#changer input {
	margin: 0;
}
const container = document.querySelector('.container');
const changer = document.querySelector('#changer');

const update = () => {
	const form = new FormData(changer);
	
	container.dataset.type = form.get('type');
};

changer.addEventListener('change', update);

update();

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.