Pure CSS

  • Last Updated :31 Jan, 2022

Pure CSS is a CSS framework. It is a set of free and open-source tools for building responsive websites and web applications. Yahoo developed this, which is used to make websites that are quicker, more elegant, and more responsive. It is a viable alternative to Bootstrap. Pure CSS is designed with keeping responsive design in mind. So we get prebuilt responsive styles that stay the same on all platforms.

Why Pure CSS ?

  • It designs responsive web pages for mobile devices.
  • It is a Free and open-source framework available on https://purecss.io/
  • No dependency on JavaScript and its library.
  • It also supports shadows and colors.
  • A great alternative to Bootstrap.
  • It is a Faster and Easier way for Web-Development.

Installing Pure CSS: There are two methods by which we can install and run the code.

1. Using NPM Install: You can add Pure CSS to your project through npm. This is our recommended way to integrate styles into your project’s build process and toolchain. To run this command, first, need to install the node.

$ npm install purecss --save

2. Using CDN Link: You can add Pure CSS to your web page via the free unpkg CDN link. Just add the following <link> element into your page <head> section, before your project’s style sheets.

<link rel=”stylesheet” href=”https://unpkg.com/[email protected]/build/pure-min.css” integrity=”sha384-LTIDeidl25h2dPxrB2Ekgc9c7sEC3CWGM6HeFmuDNUjX76Ert4Z4IY714dhZHPLd” crossorigin=”anonymous”>

Now let’s understand the working of pure CSS using an example.

Example: The following example shows a simple dropdown menu and a drop-down with different background colors created by using the background-color property of CSS.

HTML

<!DOCTYPE html>
 <html lang="en">
 
 <head>
 <meta charset="utf-8">
 <meta name="viewport" content="width=device-width, initial-scale=1">
 <link rel="stylesheet" href="https://unpkg.com/[email protected]/build/pure-min.css"
 integrity="sha384-LTIDeidl25h2dPxrB2Ekgc9c7sEC3CWGM6HeFmuDNUjX76Ert4Z4IY714dhZHPLd"
 crossorigin="anonymous">
 </head>
 
 <body>
 <center>
 <h2 style="color:green;">
 GeeksforGeeks
 </h2>
 </center>
 
 <div class="pure-menu pure-menu-horizontal">
 <ul class="pure-menu-list">
 <li class="pure-menu-item pure-menu-selected">
 <a href="#" class="pure-menu-link">Home</a>
 </li>
 <li class="pure-menu-item pure-menu-has-children
 pure-menu-allow-hover">
 <a href="#" class="pure-menu-link">Courses</a>
 <ul class="pure-menu-children">
 <li class="pure-menu-item">
 <a href="#" class="pure-menu-link">
 Placement 100</a>
 </li>
 <li class="pure-menu-item">
 <a href="#" class="pure-menu-link">
 Complete Interview Preparation</a>
 </li>
 <li class="pure-menu-item">
 <a href="#" class="pure-menu-link">
 Android Bootcamp</a>
 </li>
 </ul>
 </li>
 <li class="pure-menu-item pure-menu-has-children
 pure-menu-allow-hover"
 style="background-color: green;">
 
 <a href="#" class="pure-menu-link"
 style="color:white;">
 Contact US
 </a>
 
 <ul class="pure-menu-children">
 <li class="pure-menu-item">
 <a href="#" class="pure-menu-link">
 At Office
 </a>
 </li>
 <li class="pure-menu-item">
 <a href="#" class="pure-menu-link">
 At Headquarter
 </a>
 </li>
 <li class="pure-menu-item">
 <a href="#" class="pure-menu-link">
 Via mail
 </a>
 </li>
 </ul>
 </li>
 </ul>
 </div>
 </body>
 
 </html>
 

Output:

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

My Personal Notesarrow_drop_up

Writing code in comment? Please use ide.geeksforgeeks.org, generate link and share the link here.