DEV Community

Cover image for HTML tags | slot
Carlos Espada
Carlos Espada

Posted on • Edited on

1

HTML tags | slot

The <slot> HTML element —part of the Web Components technology suite— is a placeholder inside a web component that you can fill with your own markup, which lets you create separate DOM trees and present them together.

It defines a slot that is typically used in a shadow tree.

The name attribute is used to assign slots to other elements: a slot element with a name attribute creates a named slot to which any element is assigned if that element has a slot attribute whose value matches that name attribute's value, and the slot element is a child of the shadow tree whose root's host has that corresponding slot attribute value.

You can use the <template> and <slot> elements to create a flexible template that can then be used to populate the shadow DOM of a web component.

  • Type: -
  • Self-closing: No
  • Semantic value: No

Definition and example | Support

Sentry blog image

How to reduce TTFB

In the past few years in the web dev world, we’ve seen a significant push towards rendering our websites on the server. Doing so is better for SEO and performs better on low-powered devices, but one thing we had to sacrifice is TTFB.

In this article, we’ll see how we can identify what makes our TTFB high so we can fix it.

Read more

Top comments (0)