EN
Programming - kebab-case definition with example
7
points
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:
- combine words with dashes (
-
), - 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 npmreact-router
, etc.