Last active
          September 9, 2020 11:40 
        
      - 
      
- 
        Save fabriziofeitosa/3d020e510e4dd8c7e3d13ac27cab24b8 to your computer and use it in GitHub Desktop. 
    (CSS) Constant width to height ratio 
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | .constant-width-to-height-ratio { | |
| background: #333; | |
| width: 50%; | |
| } | |
| .constant-width-to-height-ratio::before { | |
| content: ''; | |
| padding-top: 30%; | |
| float: left; | |
| } | |
| .constant-width-to-height-ratio::after { | |
| content: ''; | |
| display: block; | |
| clear: both; | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
Deixa uma DIV com altura proporcional a largura.
padding-topdefine o tamanho da altura proporcional a largurapadding-top: 30%;quer dizer que a altura vai ter um valor de 30% em relação a largura.Você só precisa mexer na primeira e segunda Class CSS, no valores
widthepadding-top.