Dash Character

Share

What is a Dash Character?

The dash (-), also called hyphen, or minus sign, is a character commonly found in text codes, specially as a substitute for the space character ( ) in contexts where spaces can't be used.

Usage Examples

In Usernames

The dash is a character that is allowed in usernames in some websites that don't allow spaces in usernames.

Typically, dashes aren't allowed, only underscores (_) are allowed, but there are exceptions. Notably, on Bluesky, underscores aren't allowed, but dashes are.

In Urls

The dash is found in URLs. If you have a webpage for "Movie Reviews," it likely has a URL such as https://example.com/movie-reviews/. That's because you can't have a space in the URL, so the dash (-) is used as its substitutes.

Text code used in URLs like this are normally called slugs, e.g. movie-reviews is the slug of the Movie Reviews' webpage. One exception are URLs for profile pages on social media, where the term handle is used to refer to the user's username or other identifier that is part of the URL.

In HTML, CSS, and XML

Dashes are part of comments in HTML and XML, which begin with <!-- and end in -->.

The classes of a HTML element are separated by spaces, so words are separated by dashes by convention.

<div class="large-panel red-text">...</div>

In a CSS class naming methodology called BEM, Block__Element--Modifier, you use two underscores to separate block from element, and two dashes to separate it from the modifier.

In SQL

Comments in SQL start with two dashes --.

Linux Permissions

On Linux, dashes are used in the RWX notation for file permissions, e.g. r-- means a file only has read permission, and not write or execute permission.

Comments

Leave a Reply

Leave your thoughts! Required fields are marked *