CSS Grid Layout with float and flexbox fallbacks
How do I make an css grid layout with float and flexbox fallbacks?
Basic grid using floats, then uses CSS Feature Queries ( @supports ... ) to determine if the browser supports Flexbox or CSS Grid Layout. CSS Grid Layout works in Safari Technical Preview, WebKit Nightly and Firefox Nightly out of the box. Chrome works with Experimental Extension APIs enabled at chrome://flags/ and in Firefox with layout.css.grid.enabled flag by going to about:config.. What is a css grid layout with float and flexbox fallbacks? How do you make a css grid layout with float and flexbox fallbacks? This script and codes were developed by Stacy on 24 September 2022, Saturday.
CSS Grid Layout with float and flexbox fallbacks - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Grid Layout with float and flexbox fallbacks</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel='stylesheet prefetch' href='css/nbvany.css'>
<link rel='stylesheet prefetch' href='css/morrqg.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1 class="page-title">Float, Flexbox and CSS Grid Layout by using CSS Feature Queries</h1>
<main class="grid"> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">Grid works in Safari Technical Preview, WebKit Nightly and Firefox Nightly out of the box.</h1> <p class="entry-preview"> <!-- CSS Grid Layout browser support text --> <p>Experiment with me! CSS Grid Layout works in Firefox 52, Safari 10.1 (and iOS), Chrome 57 (and Chrome 57 for Android) and Opera. Microsoft is currently working on <a href="https://developer.microsoft.com/en-us/microsoft-edge/platform/status/gridupdate/?q=grid">implementation</a>.</p> </p> </article> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">I am a post title, you won't believe what happens next!</h1> <p class="entry-preview">This is a short entry preview text to entice you to click on my post and read … <a href="#">Read more</a></p> </article> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">I am a post title, you won't believe what happens next!</h1> <p class="entry-preview">This is a short entry preview text to entice you to click on my post and read … <a href="#">Read more</a></p> </article> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">I am a post title, you won't believe what happens next!</h1> <p class="entry-preview">This is a short entry preview text to entice you to click on my post and read … <a href="#">Read more</a></p> </article> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">I am a post title, you won't believe what happens next!</h1> <p class="entry-preview">This is a short entry preview text to entice you to click on my post and read … <a href="#">Read more</a></p> </article> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">I am a post title, you won't believe what happens next!</h1> <p class="entry-preview">This is a short entry preview text to entice you to click on my post and read … <a href="#">Read more</a></p> </article> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">I am a post title, you won't believe what happens next!</h1> <p class="entry-preview">This is a short entry preview text to entice you to click on my post and read … <a href="#">Read more</a></p> </article> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">I am a post title, you won't believe what happens next!</h1> <p class="entry-preview">This is a short entry preview text to entice you to click on my post and read … <a href="#">Read more</a></p> </article> <article> <img class="preview-image" src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/150150/oprah.jpg"> <h1 class="entry-title">I am a post title, you won't believe what happens next!</h1> <p class="entry-preview">This is a short entry preview text to entice you to click on my post and read … <a href="#">Read more</a></p> </article>
</main>
<aside class="support"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<path d="M20.016 8.016v-4.031h-4.031v4.031h4.031zM20.016 14.016v-4.031h-4.031v4.031h4.031zM20.016 20.016v-4.031h-4.031v4.031h4.031zM14.016 8.016v-4.031h-4.031v4.031h4.031zM14.016 14.016v-4.031h-4.031v4.031h4.031zM14.016 20.016v-4.031h-4.031v4.031h4.031zM8.016 8.016v-4.031h-4.031v4.031h4.031zM8.016 14.016v-4.031h-4.031v4.031h4.031zM8.016 20.016v-4.031h-4.031v4.031h4.031zM20.016 2.016c1.078 0 1.969 0.891 1.969 1.969v16.031c0 1.078-0.891 1.969-1.969 1.969h-16.031c-1.078 0-1.969-0.891-1.969-1.969v-16.031c0-1.078 0.891-1.969 1.969-1.969h16.031z"></path>
</svg> <a class="unsupported" href="http://caniuse.com/#feat=css-grid">This browser does not support CSS Grid Layout.</a> <a class="supported" href="http://caniuse.com/#feat=css-grid">This browser supports CSS Grid Layout.</a>
</aside>
</body>
</html>
CSS Grid Layout with float and flexbox fallbacks - Script Codes CSS Codes
// Media Queries: https://codepen.io/stacy/pen/mOrrQg
// Grid Demo Important CSS Stuff
.grid { padding: 0 2rem; // If your browser supports flexbox, do this @supports ( display: flex ) { display: flex; flex-wrap: wrap; padding: 1rem; @include bp( small ) { justify-content: space-between; } } // If your browser supports grid, do this // Grid only works when enabled in certain browsers // Works OOTB w/Firefox Nightly and Safari Technical Preview // Won't work on your phone @supports ( display: grid ) { display: grid; grid-template-columns: 100%; grid-template-rows: auto; // Make only 2 columns using the new fraction unit and include a gap (gutter) @include bp( small ) { grid-template-columns: 1fr 1fr; grid-gap: 1fr; } // When above our large breakpoint, make sure we have 3 columns @include bp( large ) { grid-template-columns: 1fr 2fr 1fr; } }
}
article { background: #fff; margin: 1rem 0; padding: 1rem; // Let's start with a float fallback // Not needed for the most part unless // you still support IE9 and lower @include bp( small ) { float: left; margin: 1rem; max-width: 41%; &:nth-child(2n+1) { clear: left; } @supports ( display: grid ) { max-width: none; } } @include bp( large ) { max-width: 20%; @supports ( display: grid ) { max-width: none; } &:nth-child(2n+1) { clear: none; } &:nth-child(3n+2) { max-width: 45%; @supports ( display: grid ) { max-width: none; } } &:nth-child(3n+1) { clear: left; } } // If your browser supports flexbox, do this @supports ( display: flex ) { flex-basis: 100%; // Display 2 columns at this medium breakpoint @include bp( small ) { flex: 0 1 40%; } // Display 3 columns at this large breakpoint @include bp( large ) { flex: 0 1 calc(100% * 0.25 - 1rem); &:nth-child(3n+2) { flex: 1 0 calc(100% * 0.25 - 1rem); } } }
}
// For fun styles
@import 'https://fonts.googleapis.com/css?family=Dosis:400,700|Slabo+27px';
body { background: #e3e3e3; font-family: 'Dosis', serif;
}
.page-title { color: #556270; font-family: 'Slabo 27px', serif; font-size: 1.5rem; margin-bottom: 0; padding: .5rem 0 0; text-align: center;
}
p { line-height: 1.4;
}
.intro { font-size: 1rem; text-align: center;
}
.entry-title { color: #4b4b4b; font-family: 'Slabo 27px', serif; font-size: 1.75rem; article:nth-of-type(3n+2) & { @include bp( large ) { font-size: 2.5rem; } }
}
a { color: #C44D58; font-family: 'Dosis', serif; font-weight: 700;
}
img { height: auto; width: 100%; -webkit-filter: saturate(0); filter: saturate(0);
}
Developer | Stacy |
Username | stacy |
Uploaded | September 24, 2022 |
Rating | 4.5 |
Size | 5,665 Kb |
Views | 38,456 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
CSS Grid Layout | 4,172 Kb |
Shape Outside - Polygon | 3,954 Kb |
Shape Outside - Ellipse | 3,568 Kb |
Knockout Text with CSS Blend Modes | 3,382 Kb |
Spring Color Palette | 3,596 Kb |
Color Palette sample in a simple style guide template | 5,318 Kb |
Using Sass Maps to build a color palette | 3,715 Kb |
CSS Grid Layout - Blog Post Template | 5,461 Kb |
CSS Grid Layout Demo 5 - Grid Gap | 4,833 Kb |
CSS Filters | 3,506 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Glitchy Text Effect | Kescoe | 2,208 Kb |
Static Image to Video Block | Grayghostvisuals | 4,864 Kb |
Wikipedia viewer | Chpecson | 2,865 Kb |
Slick Slider | Wearebold | 5,913 Kb |
Shopping cart | Andiio | 6,581 Kb |
Incremental game | Eprouver | 5,868 Kb |
Headroom.js demo | WickyNilliams | 3,982 Kb |
Parallax scrolling scene | Iharosi | 2,485 Kb |
ASCII triangle image overlay | Mitchdot | 2,200 Kb |
Drifting Clouds | Benedikte | 2,247 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!