Home >Web Front-end >CSS Tutorial >What does @ in css mean?
<p>In CSS, the "@" symbol indicates the beginning of a directive or rule set. Directives provide CSS interpretation information, rule sets contain rules for styling HTML elements, and the "@" symbol in an attribute value represents a variable or function.<p> <p>The meaning of the @ symbol in CSS <p>In CSS, the "@" symbol is a special character. Used for the following purposes: <p>1. Directives <p>@ The "@" symbol indicates a CSS directive that provides information on how to interpret other CSS rules. The most common instructions are:
@charset
: Specifies the character encoding of the text file. @import
: Import another CSS file. @media
: Applies different styles based on device or media type. <code>@selector { property: value; }</code><p>For example:
<code>@p { font-size: 12px; }</code><p>This will set a font size of 12 pixels for the
<p>
element in HTML.
<p>3. Attribute value
<p>In CSS attribute values, the @"@" symbol is sometimes used to indicate a variable or function. For example:
<code>color: @primary-color;</code><p>This sets the color property to the value of a variable named
@primary-color
.
<p>Note:
The above is the detailed content of What does @ in css mean?. For more information, please follow other related articles on the PHP Chinese website!