Search
 
SCRIPT & CODE EXAMPLE
 

CSS

css media query aspect ratio

/* Minimum aspect ratio */
@media (min-aspect-ratio: 8/5) {
  div {
    background: #9af; /* blue */
  }
}

/* Maximum aspect ratio */
@media (max-aspect-ratio: 3/2) {
  div {
    background: #9ff;  /* cyan */
  }
}

/* Exact aspect ratio, put it at the bottom to avoid override*/
@media (aspect-ratio: 1/1) {
  div {
    background: #f9a; /* red */
  }
}
Comment

aspect ratio css media query

/* Minimum aspect ratio */
@media (min-aspect-ratio: 8/5) {
  div {
    background: #9af; /* blue */
  }
}

/* Maximum aspect ratio */
@media (max-aspect-ratio: 3/2) {
  div {
    background: #9ff;  /* cyan */
  }
}

/* Exact aspect ratio, put it at the bottom to avoid override*/
@media (aspect-ratio: 1/1) {
  div {
    background: #f9a; /* red */
  }
}
Comment

PREVIOUS NEXT
Code Example
Css :: css keep image ratio 
Css :: css remove scrollbar from body 
Css :: position relative get in center 
Css :: background overlay css 
Css :: how to mirror flip a video tag css 
Css :: css dynamic grid layout 
Css :: css center grid 
Css :: make triangle using div 
Css :: box shadow to make border bottom 
Css :: responsive css grid 
Css :: transition transform 
Css :: input remove blue glow 
Css :: ho to choose the first child of parent in css 
Css :: hover button scss 
Css :: css smooooooth scroll 
Css :: css table border-collapse 
Css :: google font roboto 
Css :: keep aspect ratio of image css 
Css :: ovale css 
Css :: 3 column responsive grid css 
Css :: webkit-line-clamp browser support 
Css :: remove background when autofill input css 
Css :: word ellipsis css 
Css :: overflow: scroll displaces the inline element 
Css :: css list style url siz 
Css :: button onclick open video in new window 
Css :: css jagged edges 
Css :: Adding gradient to text color 
Css :: reduire espace entre ligne css 
Css :: css 2 bilder nebeneinander 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =