Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Ivan Enderlin 🦀
Ivan Enderlin 🦀
@hywan@floss.social  ·  activity timestamp 2 weeks ago

You can make up HTML tags, https://maurycyz.com/misc/make-up-tags/.

So, yes, it’s a bit unknown but it’s totally correct to have HTML elements like `<foo-bar>`. The hyphens declares an _unknown custom element_ (which becomes known once defined with JavaScript), and is perfectly valid. You can style it, like any other element.

Too bad the examples in the article are not great: semantically correct elements exist such as `article`, `blockquote` etc.

#html #CustomElement

You can make up HTML tags: (Maurycy's blog)

  • Copy link
  • Flag this post
  • Block
alcinnz
alcinnz
@alcinnz@floss.social replied  ·  activity timestamp 2 weeks ago

@hywan I'll note: The only reason browsers ask you to include the hyphen is for forward-compatibility. They might want to define new elements (without hyphens) in the future, at which point pages which uses them for something else *might* break.

Still... It'd work for now even if you exclude hyphens!

  • Copy link
  • Flag this comment
  • Block
Ivan Enderlin 🦀
Ivan Enderlin 🦀
@hywan@floss.social replied  ·  activity timestamp 2 weeks ago

@alcinnz Yes and no. An unknown tag without a hyphen is an… unknown element, which is an error. However, an unknown custom element _is_ a valid element 😁.

  • Copy link
  • Flag this comment
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct