Languages
[Edit]
EN

Programming - kebab-case definition with example

7 points
Created by:
Root-ssh
175450

In this article, we would like to explain the concept of the kebab-case naming style.

Kebab case example:

kebab-case-name-example

SCREAM-KEBAB-CASE-NAME-EXAMPLE

The main idea is to:

  1. combine words with dashes (-),
  2. write all letters in lowercase or uppercase.

 

Hint: kebab case with all uppercase letters is called as a scream kebab case.

 

Practical examples:

Input (regular text)     Output (in kebab-case)
--------------------     --------------------

E-book                   e-book
This is example text     this-is-example-text
HTML content             html-content
main HTML content        main-html-content
new HTTP APR library     new-http-apr-library

Scream kebab             SCREAM-KEBAB

 

Used in:

  • segments in URLs,
    e.g. https://domain.com/css/file-name.css,
  • names and values in URL parameters,
    e.g. https://domain.com?page-number=1,
  • CSS class names,
    e.g. site-header,
  • HTML id attribute names and values,
    e.g. data-user-id="some value here ...", id="site-header",
  • HTTP headers,
    e.g. content-type (in HTTP 1.1 and older: Content-Type),
  • package names,
    e.g. in npm react-router, etc.

 

See also

  1. Programming - Case Styles

References

  1. Naming convention (programming) - Delimiter-separated words - Wikipedia
  2. PascalCase - Wikipedia

Alternative titles

  1. Programming - kebab case definition with example
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Programming - Case Styles

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join