Skip to content
Related Articles

Related Articles

Primer CSS Link and Color Utilities

View Discussion
Improve Article
Save Article
  • Last Updated : 25 Apr, 2022

Primer CSS is a free open-source CSS framework that is built upon systems that create the foundation of the basic style elements such as spacing, typography, and color. This systematic method makes sure our patterns are steady and interoperable with every other. Its approach to CSS is influenced by Object-Oriented CSS principles, functional CSS, and BEM architecture. It is highly reusable and flexible. It is created with GitHub’s design system.

Primer CSS Link and Color Utilities are used to add the color utility classes with the links to clearly show the information inside the link using colors. When we hover over the links then they will turn into the one color.

Primer CSS Link and Color Utilities Classes:

  • color-fg-*: These color utility classes are used to give colors to the text and links.

Syntax:

<a class="Link--primary" href="#url">
  <span class="color-fg-*">
       ...
  </span>
</a>

Example 1: This example demonstrates the implementation of Primer CSS Link and Color Utilities.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title> Primer CSS Link and Color Utilities </title>
    <link rel="stylesheet" href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css" /> 
</head>
  
<body>
    <div class="text-center">
        <h1 class="color-fg-success"> GeeksforGeeks </h1>
        <h3> Primer CSS Link and Color Utilities </h3> <br>
  
        <a class="Link--primary text-bold" href="#">
            <h3 class="color-fg-attention">
                GeeksforGeeks website
            </h3>
        </a>
    </div>
</body>
  
</html>


Output:

 Primer CSS Link and Color Utilities 

Example 2: This example demonstrates the implementation of Primer CSS Link and Color Utilities using the SVG icon.

HTML




<!DOCTYPE html>
<html>
  
<head>
    <title> Primer CSS Link and Color Utilities </title>
    <link rel="stylesheet" href=
"https://unpkg.com/@primer/css@^18.0.0/dist/primer.css" /> 
</head>
  
<body>
    <div class="text-center">
        <h1 class="color-fg-success"> GeeksforGeeks </h1>
        <h3> Primer CSS Link and Color Utilities </h3> <br>
  
        <a class="Link--primary text-bold" href="#">
            <svg class="octicon octicon-octoface color-fg-danger" 
                 viewBox="0 0 16 16" width="18" height="18" >
                <path fill-rule="evenodd" 
                    d="M11.5 7a4.499 4.499 0 11-8.998 
                    0A4.499 4.499 0 0111.5 7zm-.82 4.74a6 
                    6 0 111.06-1.06l3.04 3.04a.75.75 0 
                    11-1.06 1.06l-3.04-3.04z">
                </path>
            </svg>
            <span class="color-fg-success"> Open </span>
            <span class="color-fg-muted"> GeeksforGeeks </span>
            <span class="color-fg-danger"> website </span>
        </a>
    </div>
</body>
  
</html>


Output:

 Primer CSS Link and Color Utilities 

Reference: https://primer.style/css/components/links#link-and-color-utilities


My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!