CSS Data Type - <custom-ident> (2024)

  • Selected Reading
  • UPSC IAS Exams Notes
  • Developer's Best Practices
  • Questions and Answers
  • Effective Resume Writing
  • HR Interview Questions
  • Computer Glossary
  • Who is Who

'; var adpushup = adpushup || {}; adpushup.que = adpushup.que || []; adpushup.que.push(function() { adpushup.triggerAd(ad_id); });

CSS data type <custom-ident> represents a custom identifier. It is used to denote custom names or identifiers that developers define for certain CSS properties or values. This data type allows for a broader range of possibilities by enabling the use of custom names beyond the predefined keywords and standard identifiers.

Custom identifiers are typically used in situations where developers want to create and use their own naming conventions for certain aspects of styling or theming.

For example, in the context of CSS variables (custom properties), you might use <custom-ident> to represent a custom identifier for a variable name:

:root { --main-color: red;}.element { color: var(--main-color);}

In this example, --main-color is a custom identifier, and the var() function is used to reference the value stored in the custom property.

Forbidden Values

To prevent uncertainity, each property that uses <custom-ident> forbids the use of specific values as listed below:

  • animation-name − Global CSS values (unset, initial, inherit and none) are forbidden.

  • counter-reset, counter-increment − Global CSS values (unset, initial, inherit and none) are forbidden.

  • @counter-style, list-style-type − Global CSS values (unset, initial, inherit) are forbidden alongwith (none, inline, outside), as well as the values: disc, circle, square, decimal, cjk-decimal, decimal-leading-zero, lower-roman, upper-roman, lower-greek, lower-alpha, lower-latin, upper-alpha, upper-latin, arabic-indic, armenian, bengali, cambodian, cjk-earthly-branch, cjk-heavenly-stem, cjk-ideographic, devanagari, ethiopic-numeric, georgian, gujarati, gurmukhi, hebrew, hiragana, hiragana-iroha, japanese-formal, japanese-informal, kannada, katakana, katakana-iroha, khmer, korean-hangul-formal, korean-hanja-formal, korean-hanja-informal, lao, lower-armenian, malayalam, mongolian, myanmar, oriya, persian, simp-chinese-formal, simp-chinese-informal, tamil, telugu, thai, tibetan, trad-chinese-formal, trad-chinese-informal, upper-armenian, disclosure-open, disclosure-close.

  • grid-row-start, grid-row-end, grid-column-start, grid-column-end − The span value is forbidden.

  • view-transition-name − Global CSS values (unset, initial, inherit) are forbidden, as well as none.

  • will-change − Global CSS values (unset, initial, inherit), as well as the values (will-change, auto, scroll-position, and contents) are forbidden.

Syntax

The syntax for CSS <custom-ident> follows the same rules as CSS property names, except that it is case-sensitive. This element includes one or more characters, defined as any of the following:

  • Any alphabetical letter from A to Z or a to z.

  • Any decimal digit from 0 to 9.

  • The hyphen (-) character.

  • The underscore (_) character.

  • An escaped character is defined as a character that comes after a backslash (/).

  • A Unicode character represented by a backslash (/) followed by one to six hexadecimal digits.

Escaping characters

Unicode code points can be included in a <custom-ident> or quoted <string> by escaping them.

CSS provides various ways of escaping a character. Escape sequences begin with a backslash (\) and follow with:

  • Hexadecimal sequences of one to six digits (ABCDEF0123456789) can be optionally followed by white space. These sequences are replaced by the Unicode code point corresponding to the specified hex digits, with the whitespace allowing subsequent actual hex digits.

  • Any Unicode code point that is neither a hex number nor a newline character.

Examples:

  • "&B" can be represented as \26 B or \000026B.

  • "hi.there" can be represented as hi\.there or hi\002Ethere.

  • "toto?" can be written as toto\?, toto\3F, or toto\00003F.

Valid Identifier

The following syntax represents a combination of alphanumeric characters and digits −

tata59 A combination of alphanumeric characters and numbers.high-level A combination of alphanumeric characters and a dash-nest Alphanumeric characters are placed after a dash._external Alphanumeric characters are placed after a underscore.\11 nono A group of alphanumeric characters that follows a Unicode character.tili\.wow A correctly escaped period.

Invalid Identifier

The following syntax represents specific rules for representing values −

24rem It must not begin with a decimal digit.-16rad It cannot begin with a dash followed by a decimal digit.tili.wow The only characters that don't require escape are alphanumeric characters, _, and -.'tiliwow' This would be a <string>."tiliwow" This would be a <string>.

CSS <custom-ident> - animation-name

The following example demonstrates the use of animation-name property by defining @Keyframes -demoanimation. The hyphen(-) naming convention is attached to CSS syntax as custom identifier −

<html><head><style> @keyframes -demoanimation { 0% { transform: translateX(0); } 50% { transform: translateX(100px); } 100% { transform: translateX(0); } } .box { width: 100px; height: 100px; background-color: pink; animation-name: -demoanimation; animation-duration: 3s; animation-iteration-count: infinite; }</style></head><body> <div class="box"></div></body></html>

CSS <custom-ident> - counter-reset, counter-increment

The following example demonstrates the use of counter-reset property with the custom-identifier demo-counter and sets its initial value to 0. The counter-increment property increments the value of the counter each time −

<html><head><style> body { counter-reset: demo-counter; } p::before { content: counter(demo-counter); counter-increment: demo-counter; margin: 5px; }</style></head><body> <div> <p>First Paragraph</p> <p>Second Paragraph</p> <p>Third Paragraph.</p> </div></body></html>

Advertisem*nts

';adpushup.triggerAd(ad_id); });

CSS Data Type - <custom-ident> (2024)

FAQs

What is ident in CSS? ›

The <custom-ident> CSS data type denotes an arbitrary user-defined string used as an identifier. It is case-sensitive, and certain values are forbidden in various contexts to prevent ambiguity.

What is CSS data? ›

CSS data types define typical values (including keywords and units) accepted by CSS properties and functions. They are a special kind of component value type. The most commonly-used types are defined in the CSS Values and Units specification.

What are CSS identifiers? ›

The CSS id Selector

The id selector uses the id attribute of an HTML element to select a specific element. The id of an element is unique within a page, so the id selector is used to select one unique element! To select an element with a specific id, write a hash (#) character, followed by the id of the element.

How do I indent in CSS? ›

You can use the CSS text-indent property to indent text in any block container, including divs, headings, asides, articles, blockquotes, and list elements. Say you want to indent all div elements containing text on a page to the right by 50px. Then, using the CSS type selector div, set the text-indent property to 50px.

What is CSS examples? ›

Example CSS Syntax

color: red; - changes the text color of <p> contents to red. font-size: 20px; - changes the font size of <p> contents to 20px. background-color: yellow; - sets the background of the <p> element to yellow.

How to give CSS to data id? ›

CSS ID selector

To use an ID selector in CSS, you simply write a hashtag (#) followed by the ID of the element. Then put the style properties you want to apply to the element in brackets. There are a few rules you must follow to use the CSS ID selector correctly.

How to pass data attribute to CSS? ›

The attr() CSS function is used to retrieve the value of an attribute of the selected element and use it in the stylesheet. It can also be used on pseudo-elements, in which case the value of the attribute on the pseudo-element's originating element is returned.

What is the purpose of an ident? ›

An ident is a short sequence shown on television between programmes to identify the channel. Idents are also used to portray the channels feel over to the audience.

What does ident stand for? ›

The Automated Biometric Identification System (IDENT) is the central Department of Homeland Security (DHS)-wide system for storage and processing of biometric and associated biographic information for national security; law enforcement; immigration and border management; intelligence; background investigations for ...

What is the usage of ident? ›

The Ident Protocol (Identification Protocol, Ident), specified in RFC 1413, is an Internet protocol that helps identify the user of a particular TCP connection. One popular daemon program for providing the ident service is identd.

What is ident in coding? ›

Indentation is the visual structure of how your code is laid out. It uses tabs to organize code into a hierarchy. Having correct indentation is a crucial aspect of programming style.

Top Articles
Latest Posts
Article information

Author: Dong Thiel

Last Updated:

Views: 5303

Rating: 4.9 / 5 (79 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Dong Thiel

Birthday: 2001-07-14

Address: 2865 Kasha Unions, West Corrinne, AK 05708-1071

Phone: +3512198379449

Job: Design Planner

Hobby: Graffiti, Foreign language learning, Gambling, Metalworking, Rowing, Sculling, Sewing

Introduction: My name is Dong Thiel, I am a brainy, happy, tasty, lively, splendid, talented, cooperative person who loves writing and wants to share my knowledge and understanding with you.