Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: CSS
Posted by: Marosi Dóra
Added: Jan 5, 2018 12:26 PM
Views: 8
Tags: no tags
  1. .container {
  2.     background-color: red;
  3.     width: 100%;
  4.     padding-top: 100%; /* 1:1 Aspect Ratio */
  5.     position: relative; /* If you want text inside of it */
  6. }
  7.  
  8. /* If you want text inside of the container */
  9. .text {
  10.     position: absolute;
  11.     top: 0;
  12.     left: 0;
  13.     bottom: 0;
  14.     right: 0;
  15. }