Square DIV where height is equal to viewport April 19, 2023 by Tarik Billa There is a neat trick using pure css that i stumbled upon: #square { width: 100%; height: 0; padding-bottom: 100%; } http://blog.brianjohnsondesign.com/2013/maintain-aspect-ratio-for-html-element-using-only-css-in-a-responsive-design/ More Related Contents: I want to get this CSS shape and have a background puicture inside it Element will not stay centered, especially when re-sizing screen Grid of responsive squares Responsive grid of hexagons Maintain the aspect ratio of a div with CSS How to use CSS to surround a number with a circle? html/css hexagon with image inside Easier way to create circle div than using an image? HTML5 / CSS3 Circle with Partial Border Create a slanted edge to a div [duplicate] Draw Circle using css alone [duplicate] Creating a ‘New’ spiky label with 24 or above point burst Half circle with CSS (border, outline only) How to add border to a container with transparent gaps in between Slanted diagonal line in html or css? How can I make a 45 degree responsive ribbon with folded corner? Border with a transparent centred arrow Add outward curving border to elements like this: ◝◟___◞◜ How to create a curved speech bubble? How can I make a div with irregular shapes with css3 and html5? How can I create a wavy shape CSS? How to Make A Chevron Arrow Using CSS? How to auto-resize an image while maintaining aspect ratio div with triangle at the bottom with background image Responsive CSS Circles CSS Zigzag Border with a Textured Background How do I create a teardrop in HTML? How to create a heart shape using CSS? Make plus symbol in CSS Create wavy borders in CSS for top and bottom borders