CSS @charset Rules

You are Here:

CSS @charset Rules

CSS @charset rule specifies the character encoding used in the style sheet.

Declaration Rules

The following rules must be followed while declaring @charset.

  • The @charset rule must be the first element in the style sheet and not be preceded by any character.
  • If several @charset rules are defined, only the first one is used.
  • The @charset rule cannot be used inside a style attribute (on an HTML element), or inside the <style> element where the character set of the HTML page is relevant.

Example

myStyle.css
@charset "utf-8"; body{ font-size: 17px; } h1{ color: green; }

Syntax

In External Stylesheet

@charset "utf-8";

Reminder

Hi Developers, we almost covered 98.7% of CSS Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in CSS.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author