Selecting all But the First Custom Element

Image by analogicus from Pixabay

Scenario

We have multiple custom elements in a container like this:

<app-header-selection></app-header-selection>
<app-header-selection></app-header-selection>

We want a CSS selector that selects all but the element, so that we can space the remaining elements by 2rem .

Approach

app-header-selection:not(:first-of-type) {
margin-left: 2rem;
}

--

--

--

Founder of Firefly Semantics Corporation

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Agile Transformation: Finding your way in a complex world of Agile

Contributing to Open Source : Week 6

Setting Goals for Developer Relations

Devlog #002: Graphics.DrawMeshInstancedIndirect

How to Detect Problems Before They Occur with Azure Anomaly Detector

Rocketswap Update — Nov 2021

Data Processing Programming, Part 3: Separation of Concerns

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ole Ersoy

Ole Ersoy

Founder of Firefly Semantics Corporation

More from Medium

Customizing the Typography Theme for a Packaged Angular Component

Get IntelliSense for your SVG icons library using Typescript

CSS Trick: horizontal scrolling lists on mobile devices

The perfect blockquote, Part III: Conclusion