![]() |
Pure CSS is a free and open-source framework of CSS. CSS Grid Layout is a method designed for the two-dimensional layout of items with rows and columns. It consists of both unresponsive and responsive modules. Responsive design’s function is to display the contents of the website automatically across all screen resolutions and sizes, and prevents unnecessary resizing in the websites. Pure CSS Grid classes: There are two types of classes in Pure grid.
Pure Regular Grid vs Responsive Grid:
Syntax: <div class="pure-g"> <div class="pure-u-1-3"> ... </div> <div class="pure-u-1-3"> ... </div> <div class="pure-u-1-3"> ... </div> </div> The width of the grid will be 1/3rd i.e 33.33%, irrespective of the width of the screen and it will not be user-friendly on all kinds of devices. Responsive Grid:
Syntax: <div class="pure-g"> <div class="pure-u-1 pure-u-md-1-3"> ... </div> <div class="pure-u-1 pure-u-md-1-3"> ... </div> <div class="pure-u-1 pure-u-md-1-3"> ... </div> </div> On small screens, this grid will have a width of 100%, but on medium screens, it will have a width of 33.33%. Media queries for grid formation: CDN link has to be used for the access of mobile responsive Pure CSS Grid. Before the project-specific style sheets, use the link provided below between head tags. In order to generate a media query according to the screen width, these keywords are attached to the Pure grid unit (pure-u) classes. CDN link:
The following keywords are used to create a grid.
Note: In the classes, the asterisk sign (*) indicates the width of the grids and the number of columns. For example, ‘1-2’ represents, that the div will cover ‘1/2′ or 50% of the total width. ’em’ is used instead of ‘px’ to generate the default media query, so that it responds to page zoom. Example: This example will create 4 grids which will be 100% in width on the mobile screen, 50% in width on the medium screen, and 25% in width on the desktop screen. HTML
Output: ![]()
Responsive images in the grid: In Responsive Grids, images are also added as content. To maintain responsiveness .pure-img class is added inside the grid. Example: HTML
Output: ![]()
Reference: https://purecss.io/grids/#pure-responsive-grids |
Reffered: https://www.geeksforgeeks.org
CSS |
Related |
---|
![]() |
![]() |
![]() |
![]() |
![]() |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 11 |